Skip to content

Instantly share code, notes, and snippets.

@brianjmiller
brianjmiller / Gruntfile.js
Last active Aug 29, 2015
Backbone-stack updates
View Gruntfile.js
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Watching
* ========
View 20130808024530000-table-time_zones.js
var dbh = require("../migrations"),
relationName = "time_zones";
exports.up = function (next) {
dbh.schema.createTable(
relationName,
function (table) {
table.string("code", 50).primary();
table.timestamps();
table.integer("utc_offset").notNullable();
@brianjmiller
brianjmiller / base.js
Last active Jan 1, 2016
Base BB View
View base.js
return Backbone.View.extend(
{
_nodes: null,
renderCfg: function () {
return this._renderCfg || {};
},
renderContext: function () {
console.log("views/base::renderContext");
@brianjmiller
brianjmiller / gist:6174702
Last active Dec 20, 2015
Example of changing view through attach/detach
View gist:6174702
_changeView: function (newView, options) {
console.log("app::_changeView");
options = options || {};
options.renderFirst = (typeof options.renderFirst !== "undefined") ? options.renderFirst : true;
if (this._currentView !== null && this._currentView === newView) {
console.log("app::_changeView - no change needed");
return;
}
@brianjmiller
brianjmiller / gist:5814668
Last active Dec 18, 2015
PR template for browser testing
View gist:5814668
Tested in:
- [ ] Node.js
- [ ] Chrome
- [ ] FireFox
- [ ] Safari
- [ ] IE 11
- [ ] IE 10
- [ ] IE 9
- [ ] IE 8
@timball
timball / ssh_attach.sh
Created Dec 28, 2012
ssh_attach is to be sourced from a .profile and connects your shell to previously running ssh-agents . think of it as a slightly functional keymanager for your ssh sessions . --timball
View ssh_attach.sh
#!/bin/bash
#
# ssh_attach.sh
#
# source this file in a .bashrc .
#
# something like :
#
# # interactive shell ??
# if [ "$PS1" ]; then
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active Aug 6, 2021
Node.js - npm Cheat Sheet
View npm-cheat-sheet.md

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@jshirley
jshirley / build.js
Created Aug 1, 2012
This is a setup I'm using with a YUI_config to leverage Y.Loader to build static rollup files.
View build.js
/*
This is the Node.js file, it will export files directly to
`tdp-bundle-min.js` which obviously won't work well for you!
This relies on having a YUI_config that can be parsed and
passed into Y.Loader. Everything you need should be in this
gist, though. You may need to change the path to your
YUI_config file (mine is named `bundle.js`).
However, it's an easy change, just scroll down and edit it.
@joshbirk
joshbirk / samplerest.js
Created Feb 3, 2012
Sample of using passport w/ mult strategies
View samplerest.js
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
@brianjmiller
brianjmiller / gist:1540779
Created Dec 30, 2011
YUI: Single Template
View gist:1540779
YUI.add(
"ep-w-work_entry-base",
function (Y) {
var UI = Y.Widget.UI_SRC;
var MODE = "Mode";
var STATUS = "Status";
var WC_AC_SOURCE = "WorkChart/ac?";
var Clazz = Y.namespace("EP.W.WorkEntry").Base = Y.Base.create(