Skip to content

Instantly share code, notes, and snippets.

View gbabula's full-sized avatar
:shipit:

Greg Babula gbabula

:shipit:
View GitHub Profile
@aslansky
aslansky / gist:8741515
Created January 31, 2014 19:44
gulp livereload (gulp 3.5.0)
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var lr = require('tiny-lr');
var http = require('http');
var path = require('path');
var ecstatic = require('ecstatic');
var tlr = lr();
var livereload = function (evt, filepath) {
tlr.changed({
@gbabula
gbabula / package.json
Last active August 29, 2015 14:27
g5-component NPM scripts
"scripts": {
"serve": "http-server -p 9966",
"start": "npm run serve & npm run build",
"start-dev": "npm run serve & npm run watch",
"build-js": "browserify -u bootstrap -u jquery -u lodash -u isomorphic-fetch src/scripts/g5-component.js --s 'g5-component' | uglifyjs -mc drop_console > src/static/g5-component.js",
"build-js-vendor": "browserify -r bootstrap -r jquery -r lodash -r isomorphic-fetch | uglifyjs -mc > src/static/g5-component-vendor.js",
"build-js-full": "browserify src/scripts/g5-component.js --s 'g5-component' | uglifyjs -mc drop_console > src/static/g5-component.js",
"build-css": "lessc src/styles/component.less > src/static/bundle.css",
"build": "npm run build-js",
"watch-js": "watchify -u bootstrap -u jquery -u lodash -u isomorphic-fetch src/scripts/g5-component.js --s 'g5-component' -o src/static/g5-component.js -dv",
@addyosmani
addyosmani / composition.md
Last active January 23, 2016 21:39
JS Musings

Composition

On an architectural level, the way we craft large-scale applications in JavaScript has changed in at least one fundamental way in the last four years. Once you remove the minutia of machinery bringing forth data-binding, immutable data-structures and virtual-DOM (all of which are interesting problem spaces) the one key concept that many devs seem to have organically converged on is composition. Composition is incredibly powerful, allowing us to stitch together reusable pieces of functionality to "compose" a larger application. Composition eschews in a mindset of things being good when they're modular, smaller and easier to test. Easier to reason with. Easier to distribute. Heck, just look at how well that works for Node.

Composition is one of the reasons we regularly talk about React "Components", "Ember.Component"s, Angular directives, Polymer elements and of course, straight-up Web Components. We may argue about the frameworks and libraries surrounding t

'use strict';
// Quiz:
//
// Implement `solution` function using only calls to API methods below and no
// other JS primitives (even math).
//
// Correct implementation will print "Success!" once executed
//
@anthonyshort
anthonyshort / gist:1178298
Created August 29, 2011 12:31
Prefixing with Sass
@mixin border-radius($radius, $prefixes: -moz -webkit -o) {
@each $prefix in $prefixes {
#{$prefix}-border-radius:$radius;
}
border-radius:$radius;
}
#id {
@include border-radius(5px, -moz -webkit);
@vybs
vybs / basic_form.html
Created December 9, 2011 01:44
add position
<div class="guided-edit">
{>_close_action/}
{<closeText}{i18n_text_plain__close}{/closeText}
{?firstTaskTitleString}
<h1>{firstTaskTitleString|s}</h1>
{/firstTaskTitleString}
<form class="standard-form" id="{name}_id" name="{name}" method="{method}" action="{action}">
<fieldset>
<legend>{i18n_text_plain__what_is_your_industry}</legend>
@hyle
hyle / ko.utils.3.3.0.signatures.js
Last active April 9, 2019 13:08
KnockoutJS 3.3.0 utils (ko.utils) signatures
// knockout 3.3.0
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
@jkrems
jkrems / generators.md
Last active February 24, 2020 19:09
Generators Are Like Arrays

In all the discussions about ES6 one thing is bugging me. I'm picking one random comment here from this io.js issue but it's something that comes up over and over again:

There's sentiment from one group that Node should have full support for Promises. While at the same time another group wants generator syntax support (e.g. var f = yield fs.stat(...)).

People keep putting generators, callbacks, co, thunks, control flow libraries, and promises into one bucket. If you read that list and you think "well, they are all kind of doing the same thing", then this is to you.

@developit
developit / hydra-alias.md
Last active February 27, 2020 01:54
Alias to invoke Chrome Canary w/ tracing, for IRHydra

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome:

#!/usr/bin/env node
var program = require('commander');
var request = require('request');
var chalk = require('chalk');
program
.version('0.0.1')
.usage('[options] <keywords>')
.option('-o, --owner [name]', 'Filter by the repositories owner')