Skip to content

Instantly share code, notes, and snippets.

View jhliberty's full-sized avatar
:octocat:
It's a rails kind of year

John-Henry Liberty jhliberty

:octocat:
It's a rails kind of year
View GitHub Profile
@jhliberty
jhliberty / rb-range.js
Created May 5, 2016 11:10 — forked from thunder9/rb-range.js
A Ruby-like "range" for JavaScript
// A Ruby-like "range" for JavaScript
// https://github.com/thunder9
//
// Require: https://github.com/thunder9/rb-enumerable.js
(function (global) {
if (!global.RubyLike.enumerable || !global.RubyLike.Enumerator) {
throw Error('rb-enumerable.js required');
}
.ui.container.grid>.column>.ui.message>h1.header+p+a.ui.blue.button
@jhliberty
jhliberty / 1-sleep-es7.js
Created April 27, 2016 22:19 — forked from danharper/1-sleep-es7.js
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
@jhliberty
jhliberty / object-create-null-vs-literal.js
Created April 20, 2016 21:53
object-create-null-vs-literal
/* This exists because `Object.create(null)` is absurdly slow compared
* to `new EmptyObject()`. In either case, you want a null prototype
* when you're treating the object instances as arbitrary dictionaries
* and don't want your keys colliding with build-in methods on the
* default object prototype.
*
* See: http://jsperf.com/object-create-null-vs-literal/27
*/
const proto = Object.create(null, {
import Ember from 'ember';
export default Ember.Component.extend({
theme: Ember.inject.service()
// ...
});
@jhliberty
jhliberty / components.child-component.js
Created April 19, 2016 00:14 — forked from ZackMattor/components.child-component.js
Height toggle test, latest ember
import Ember from 'ember';
export default Ember.Component.extend({
heightToggled: false,
click() {
this.toggleProperty('heightToggled');
}
});
server {
...
location / {
try_files $uri @prerender;
}
location @prerender {
set $prerender 0;
if ($http_user_agent ~* "googlebot|bot|bingbot|adsbot-google|mediapartners-google|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinb$
@jhliberty
jhliberty / .eslintrc.js
Created March 11, 2016 23:56 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@jhliberty
jhliberty / 1 test.js
Created February 16, 2016 09:36 — forked from pghalliday/1 test.js
node.js windows spawn with cmd /s /c
var http = require('http');
var spawn = require('child_process').spawn;
var child = spawn(
'CMD', [
'/S',
'/C',
'node',
'./child.js'
]
);