Skip to content

Instantly share code, notes, and snippets.

View gist:1044951
" include other paths to look for config files
:set runtimepath=~/.vim,$VIMRUNTIME
" some basic options
:set nocompatible
:set showmatch
:set nowrap
:set ruler
:set showmode
:set backspace=2
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:7042658
Last active Dec 25, 2015
Backbone .save handlers
View gist:7042658
user.save(
userSaveData,
{
success: _.bind(this._registerSuccess, this),
error: _.bind(this._registerError, this)
}
);
_registerSuccess: function () {
console.log("views/signUp::_registerSuccess");
@brianjmiller
brianjmiller / Base class
Last active Dec 25, 2015
Basic Collection view implementation, there are better more thorough ones.
View Base class
define(
[
"backbone",
"templates",
"underscore"
],
function (Backbone, templates, _) {
"use strict";
var CLASS_EMPTY = "ws-list-empty";
View gist:6582785
PasswordReset.find(
{
include: [
User
],
where: {
token: token,
"users.email": email,
expiresAt: {
gte: (new Date())
View gist:6393294
Uri.findAll(
{
include: [
{ model: CurrentMetaData, as: "metadata" }
],
where: {
type: revTypeMap[type]
}
}
).then(
@brianjmiller
brianjmiller / gist:6321261
Created Aug 23, 2013
Sample Handlebars pre-compiled template
View gist:6321261
this["JST"]["activity/denied.html"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
helpers = helpers || Handlebars.helpers; data = data || {};
return "<h2>Activity Access Denied</h2>\n";
});
View gist:6306715
if (! DEBUG) {
if (! window.console) {
window.console = {};
}
methods = ["log", "debug", "warn", "info"];
for (i = 0; i < methods.length; i++) {
console[methods[i]] = function () {};
}
}
@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;
}