Skip to content

Instantly share code, notes, and snippets.

@cezarneaga
cezarneaga / tailwind-config-utilities.ts
Created October 10, 2023 11:35
tailwind utility functions
const plugin = require('tailwindcss/plugin');
/** @type {import('tailwindcss').Config} */
module.exports = {
...
theme: {
extend: {},
...
},
plugins: [
// default utils
@cezarneaga
cezarneaga / test.md
Created November 4, 2021 21:19
Created from Remix Form!

works

@cezarneaga
cezarneaga / cezar.md
Created November 4, 2021 21:12
Created from Remix Form!

test again

@cezarneaga
cezarneaga / internal-link.tsx
Created May 7, 2021 10:33
Next link with Chakra in TS
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export function withAppContext<
P extends { appContext?: AppContextInterface },
R = Omit<P, 'appContext'>
>(
Component: React.ComponentClass<P> | React.StatelessComponent<P>
): React.SFC<R> {
return function BoundComponent(props: R) {
return (
@cezarneaga
cezarneaga / local-ssl-certificates-that-work.md
Last active October 17, 2019 21:20
ssl ceritificates that work

local ssl certificates that work

motivation

in web dev sometimes you are constrained to develop from behind a https:// local server. i spent two days making this work and i want to write it down here, so that next time apple upgrades OS X and i decide to do a clean install (forgetting to backup certain things) i dont waste this amount of time anymore (i hope).

maybe it helps someone else too. that would make me very happy too.

forget openssl

major pita to remember commands. i don't think there is anything better that makes your mom feel like you are a hacker, than showing her how to type:

@cezarneaga
cezarneaga / js-2-tsx.sh
Created March 22, 2019 09:20
changes files extensions to tsx
shopt -s globstar # enable ** globstar/recursivity
for i in **/*.js; do
[[ -d "$i" ]] && continue; # skip directories
mv "$i" "${i/%.js}.tsx";
done
@cezarneaga
cezarneaga / arrayByArray.md
Created February 13, 2019 22:28
filter array by array
const array = [1, 2, 4]
const collection = [{ type: 1, eyes: 'blue'},{ type: 2, eyes: 'brown'}, { type: 3, eyes: 'green'}, { type: 4, eyes: 'blue'}]

const joinByType = R.innerJoin(
  (o, type) => o.type === type
)

const result = joinByType(collection, array)
@cezarneaga
cezarneaga / ReadingTime.js
Created July 9, 2018 20:16
display approximate reading time
countWords = text => {
return text.split(/\s+/).length
}
const words = this.countWords(article.body)
const readTime = Math.round(words / 250)
const minutes = readTime === 1 ? 'minute' : 'minutes'
//Render this
Aproximately {readTime} {minutes}
const path = require('path')
module.exports = {
entry: {
subdomains: './src/index.js',
},
optimization: {
occurrenceOrder: true,
splitChunks: {
cacheGroups: {