Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@alexdiliberto
alexdiliberto / gulpfile_template.js
Created January 31, 2014 05:52
Alex's gulpfile.js template
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
@alexdiliberto
alexdiliberto / ember_hooks.md
Last active August 29, 2015 13:56
Ember Hooks

Ember Hooks:

didTransition Fire on route change /ABC -> /XYZ and model change /ABC/1 -> /ABC/2

Ember.Router.reopen({
  didTransition: function() {
    this._super();
    //do stuff       
 }
@alexdiliberto
alexdiliberto / ember_longpolling.js
Last active August 29, 2015 13:57
Ember Longpolling
/**
Ember Longpolling
Periodically poll to update posts with latest comments
*/
//Create Pollster Object
App.Pollster = Ember.Object.extend({
start: function() {
this.timer = setInterval(this.onPoll.bind(this), POLL_INTERVAL);
},
@alexdiliberto
alexdiliberto / eak_testing_components.js
Created March 6, 2014 04:32
EAK - Testing Components
moduleForComponent('my-component', 'description', {
setup: function() { ... },
teardown: function() { ... }
});
@alexdiliberto
alexdiliberto / ember-view-domchanged.css
Created April 2, 2014 04:24
Quick little animation keyframe for domChanged events on Ember views
@keyframes domChanged { from { background: yellow; } }
@-webkit-keyframes domChanged { from { background: yellow; } }
.ember-view { animation: domChanged 1s; -webkit-animation: domChanged 1s; }

Keybase proof

I hereby claim:

  • I am alexdiliberto on github.
  • I am alexdiliberto (https://keybase.io/alexdiliberto) on keybase.
  • I have a public key whose fingerprint is 894B 0D4F 812A E8BA 5CBD BBF4 EF60 B9F3 A3CA E29E

To claim this, I am signing this object:

@alexdiliberto
alexdiliberto / curry-with-holes.js
Created May 4, 2014 15:57
Extends the previous curry.js to allow syntax with holes eg: fn("a", _, "c")("b")
function toArray(args) {
return [].slice.call(args);
}
function sub_curry(fn /*, variable number of args */) {
var args = [].slice.call(arguments, 1);
return function () {
return fn.apply(this, args.concat(toArray(arguments)));
};
}
@alexdiliberto
alexdiliberto / dry-css-with-sass.scss
Created May 4, 2014 20:43
DRY CSS output using Sass
/**
Placeholder - Contains all static mixin name value pairs for a particular mixin
*/
%box {
border: 1px solid;
padding: 1em;
margin: 1em;
}
/**
@alexdiliberto
alexdiliberto / jekyll-inline-code-block.rb
Last active August 29, 2015 14:02
Converts some custom Jekyll liquid tags into inline code blocks
# Convert the following liquid tags into output wrapped with <code class="inline-code"> ... </code>
# 1. {% i %} var foo="bar"; {% ei %}
# 2. {% inline %} var foo="bar"; {% endinline %}
module Jekyll
class SyntaxHighlightInlineTag < Liquid::Tag
def render(context)
'<code class="inline-code">'
end
end
@alexdiliberto
alexdiliberto / client-timezone.js
Created June 7, 2014 00:35
Get the user's timezone (client-side)
/**
Intl.DateTimeFormat().resolvedOptions()
Object {locale: "en-US", numberingSystem: "latn", calendar: "gregory", timeZone: "America/New_York", year: "numeric"…}
calendar: "gregory"
day: "numeric"
locale: "en-US"
month: "numeric"
numberingSystem: "latn"
timeZone: "America/New_York"