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');
}
@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');
})()
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');
}
});
@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'
]
);
@jhliberty
jhliberty / Node Linode Stackscript
Created January 31, 2016 12:06 — forked from marbemac/Node Linode Stackscript
Linode stackscript to setup node, deployer user, git, private networking, basic security, coffee script, and pm2 for node process management.
#!/bin/bash
# <UDF name="user_name" label="Unprivileged user account name" example="This is the account that you will be using to log in or deploy (deployer)." default="deployer" optional="false" />
# <UDF name="user_password" label="Unprivileged user password" optional="false" />
# <UDF name="user_sshkey" label="Public Key for user" default="" example="Recommended method of authentication. It is more secure than password log in." optional="false" />
# <UDF name="user_shell" label="Shell" oneof="/bin/zsh,/bin/bash" default="/bin/bash" />
# <UDF name="sys_hostname" label="System hostname" default="myvps" example="Name of your server, i.e. linode1." optional="false" />
# <UDF name="sys_private_ip" Label="Private IP" default="" example="Configure network card to listen on this Private IP (if enabled in Linode/Remote Access settings tab). See http://library.linode.com/networking/configuring-static-ip-interfaces" optional="false" />
USER_GROUPS=sudo
@jhliberty
jhliberty / froala-semantic-icons.js
Created January 27, 2016 22:56 — forked from Panman82/froala-semantic-icons.js
This is an ember-cli / ember initializer that changes the Froala Editor icons from the Font Awesome names to the Semantic UI names (technically Font Awesome just re-named). For those using Froala Editor with Semantic UI outside of the ember ecosystem, just use lines 5 to 57 and remove `Ember.` prefixes.
// app/initializers/froala-semantic-icons.js
import Ember from 'ember';
export function initialize() {
// https://www.froala.com/wysiwyg-editor/docs/concepts/custom-icon
Ember.$.FroalaEditor.ICON_DEFAULT_TEMPLATE = 'semantic_ui';
Ember.$.FroalaEditor.DefineIconTemplate( 'semantic_ui', '<i class="[NAME] icon"></i>');
Ember.$.FroalaEditor.DefineIcon( 'color' , { NAME: 'theme' } ); // tint
Ember.$.FroalaEditor.DefineIcon( 'undo' , { NAME: 'undo' } ); // rotate-left
Ember.$.FroalaEditor.DefineIcon( 'redo' , { NAME: 'repeat' } ); // rotate-right