Skip to content

Instantly share code, notes, and snippets.

View davidjsalazarmoreno's full-sized avatar
🔥
Creating

David Salazar davidjsalazarmoreno

🔥
Creating
View GitHub Profile
@ericelliott
ericelliott / cancellable-wait.js
Last active October 8, 2019 08:06
Cancellable wait -- an ES6 promise example
const wait = (
time,
cancel = Promise.reject()
) => new Promise((resolve, reject) => {
const timer = setTimeout(resolve, time);
const noop = () => {};
cancel.then(() => {
clearTimeout(timer);
reject(new Error('Cancelled'));
@srdjan
srdjan / 100+ different counter apps...
Last active February 19, 2024 22:41
100+ different js counter apps...
100+ different js counter apps...
@gaearon
gaearon / quiz.md
Last active January 11, 2024 16:56

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?


@marr
marr / extract-strings.js
Last active August 12, 2016 16:49
react-intl-webpack-plugin
import * as fs from 'fs'
import path from 'path'
import { sync as globSync } from 'glob'
import { sync as mkdirpSync } from 'mkdirp'
const MESSAGES_PATTERN = './dist/messages/**/*.json'
const LANG_DIR = './dist/lang/'
export default function() {
// Aggregates the default messages that were extracted from the example app's
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@tejacques
tejacques / HOCBaseRender.tsx
Last active May 2, 2022 13:05
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
@adamdehaven
adamdehaven / bgimage.css
Last active March 7, 2024 17:38
Bootstrap full-width hero section with text and image
.bgimage {
width:100%;
height:500px;
background: url('https://images.unsplash.com/photo-1438109491414-7198515b166b?q=80&fm=jpg&s=cbdabf7a79c087a0b060670a6d79726c');
background-repeat: no-repeat;
background-position: center;
background-size:cover;
background-attachment: fixed;
}
.bgimage h5 {
@wzup
wzup / .bashrc
Last active May 17, 2023 00:49
alias for Git Bash on Windows
# create a file C:\Users\[user]\.bashrc
# add this content
# add your onw aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"
alias ls='ls -alh'
alias cdnginx='cd /c/nginx && ls'
alias cdmcga='cd /c/Users/[user]/sbox/node/mcga && ls'
alias cdfood9='cd /c/Users/[user]/sbox/node/food9 && ls'
alias cdmysql='cd /c/nginx/mysql/bin && ls'
@ariutta
ariutta / request.md
Last active July 12, 2016 21:09
GraphQL vs. REST vs. TypeScript interfaces

We want to run the equivalent of the following, getting name, age and friends' name(s):

GET https://example.org/users/1

With GraphQL, we can use user.graphql to get the following:

      { 
        id: 'https://example.org/users/1',
@Dr-Nikson
Dr-Nikson / README.md
Last active June 8, 2023 12:04
Auth example (react + redux + react-router)