Skip to content

Instantly share code, notes, and snippets.

View esundahl's full-sized avatar

Erik Sundahl esundahl

View GitHub Profile
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.DS_Store
*.swp
@anthonyshort
anthonyshort / style.css
Created November 5, 2013 18:07
Float labels with Reactive: http://mattdsmith.com/float-label-pattern/ Just set the title on the model when
.floatLabel {
transition: all 1s ease-in-out;
position: relative;
}
.floatLabel.hide {
opacity: 0;
top: 3px;
}
@tj
tj / example.js
Created July 31, 2013 18:48
console.api()
function params(fn) {
var str = fn.toString();
var sig = str.match(/\(([^)]*)\)/)[1];
if (!sig) return [];
return sig.split(', ');
}
console.api = function(obj){
console.log();
var proto = Object.getPrototypeOf(obj);
@ianstormtaylor
ianstormtaylor / view.md
Last active December 19, 2015 17:39
View spec.

View

View(model, el, options)

The View's constructor should take an optional model. It should also take an optional el so that the user can use a pre-made element instead of the View creating its own. If necessary, it should take additional options as a dictionary.

For convenience, add an el -> options overload if you add an options argument.

View.template

The View's template should live at .template if one exists so that it can be overriden if need be. The HTML for the view's template is also part of it's spec, so it should be well thought out. Use namespaced class names for child elements to avoid collisions (for example an .integration element's label would be .integration-label).

// add s3: {key: '', secret: '', bucket: ''} to component.json
builder.use(s3);
function s3 (b) {
var s3Client;
Builder.prototype.copyTo = function (file, dest, done) {
var s3Dest = dest.replace(b.assetsDest,'');
s3Client = s3Client || knox.createClient(b.conf.s3)
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@ruzzbot
ruzzbot / grunt-bbb.js
Created July 31, 2012 03:04
JavaScript Gruntjs script for the backbone boilerplate [JavaScript,Configure,Settings,Backbone,BBB,Grunt,Bundle,Package,Template]
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
module.exports = function(grunt) {
grunt.initConfig({
// The clean task ensures all files are removed from the dist/ directory so
// that no files linger from previous builds.
clean: ["dist/"],
@paulirish
paulirish / rAF.js
Last active July 2, 2024 11:59
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];