Skip to content

Instantly share code, notes, and snippets.

💭
A well-oiled toaster oven

Jake Niemiec jakeNiemiec

💭
A well-oiled toaster oven
Block or report user

Report or block jakeNiemiec

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active Oct 5, 2019
A Gentle Introduction to Prepack, Part 1
View prepack-gentle-intro-1.md

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active Oct 19, 2019
Rails 5.2 with webpacker, bootstrap, stimulus starter
View rails_webpacker_bootstrap_expose_jquery.md

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
View ss13.sh
#!/bin/sh
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
mkdir -p log
echo -e "${GREEN}Checking for wine...${NC}"
@wesbos
wesbos / async-await.js
Created Feb 22, 2017
Simple Async/Await Example
View async-await.js
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve(''), 2000); // it takes 2 seconds to make coffee
});
}
@jakeNiemiec
jakeNiemiec / destructuring.js
Created Nov 7, 2016 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
View destructuring.js
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@HugoDF
HugoDF / join.js
Last active Oct 13, 2016
ES6 join implementation using recursion and destructuring
View join.js
function join([ head, ...tail ], separator = ',') {
if (head === undefined && !tail.length) return '';
return tail.length ? head + separator + join(tail, separator) : head;
}
@HugoDF
HugoDF / reduce.js
Last active Feb 20, 2018
ES6 reduce implementation using recursion and destructuring
View reduce.js
function reduce([ head, ...tail ], fn, initial) {
if(head === undefined && tail.length === 0) return initial;
if(!initial) {
const [ newHead, ...newTail] = tail;
return reduce(newTail, fn, fn(head, newHead));
}
return tail.length ? reduce(tail, fn, fn(initial, head)) : [ fn(initial, head) ];
}
@HugoDF
HugoDF / filter.js
Last active Oct 14, 2016
ES6 filter implementation using recursion and destructuring
View filter.js
function filter([ head, ...tail ], fn) {
const newHead = fn(head) ? [ head ] : [];
return tail.length ? [ ...newHead, ...(filter(tail, fn)) ] : newHead;
}
View FunctionalTypeScript.ts
// library or otherwise
// {
type Func<T, TResult> = (value: T) => TResult;
type Predicate<T> = Func<T, boolean>;
function compose<TIn, TMiddle, TOut>(f: Func<TMiddle, TOut>, g: Func<TIn, TMiddle>) {
return (value: TIn) => f(g(value));
}
View rc6-config.md

If you're using SystemJS in the browser, you'll want to update your System config to point at the bundles, if you're not already.

System.config({
  //use typescript for simple compilation (no typechecking)
  //transpiler: 'typescript',
  //typescript compiler options
  //typescriptOptions: {
    //emitDecoratorMetadata: true
  //},
You can’t perform that action at this time.