Skip to content

Instantly share code, notes, and snippets.

View corlaez's full-sized avatar
🏠
WFH since January 2020

Armando Cordova corlaez

🏠
WFH since January 2020
View GitHub Profile
@kentcdodds
kentcdodds / README.md
Last active August 9, 2022 09:52
Function syntaxes supported by TypeScript

TypeScript Function Syntaxes

I'm trying to create examples of all the different ways to write functions and function type definitions in TypeScript.

One requirement is these examples must work with strict mode (noImplicitAny, etc) enabled.

If I'm missing anything, please add comments below with examples. I'll eventually put this into a blog post.

@jamesreggio
jamesreggio / react-forwardref-simple-example.js
Last active January 8, 2023 21:40
Simple example usage of React.forwardRef()
// EmailInput wraps an HTML `input` and adds some app-specific styling.
const EmailInput = React.forwardRef((props, ref) => (
<input ref={ref} {...props} type="email" className="AppEmailInput" />
));
class App extends Component {
emailRef = React.createRef();
render() {
return (
@busypeoples
busypeoples / HashTrie.js
Last active July 16, 2018 18:59
Implementing persistent data structures with HashTries
// @flow
// Immutable Data Implementation
// Based on Hash Tries
// (NOTE: The actual implementation is based on hashed mapped tries!)
// But this can be seen as a basis for the actual implementation.
// This is only for learning purposes!
// Hash Trie or Hash Tree is a persistent data structure, commonly used
// to implement immuable maps.
@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];