This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" enable some stuff | |
set nocompatible | |
"enable pathogen | |
call pathogen#infect() | |
"open files relative to current file | |
cnoremap <C-E> edit <C-R>=expand("%:h")<CR>/ | |
" turn on proper file recognition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colors 1-16 | |
#cb4b16:#d68594:#859900:#b58900:#2998e6:#cbd87d:#2ba79e:#93a1a1:#cb4b16:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5 | |
cursor_color = "#686868" | |
foreground_color = "#839496" | |
background_color = "#002b36" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Assume the kanji are from | |
// http://www.ravenbrook.com/project/etp24/tool/cgi/heisig-index/?action=frame_order | |
//newlines replaced with '^' | |
var parseKanji = function (kanjiList) { | |
return kanjiList.split("^").map(function (line) { | |
var k = line.split("\t").slice(0,2); | |
return { | |
character: k[0], | |
heisigNumber: k[1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var source = Backbone.Radio.channel('source'); | |
var proxy = Backbone.Radio.channel('proxy'); | |
// 1 to 1 mapping | |
proxy.proxyEvents(source, { | |
'source:foo': 'proxy:foo' | |
}); | |
proxy.on('proxy:foo', console.log); | |
source.trigger('source:foo', 1); // triggers proxy:foo on proxy, prints 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var Promise = function (callback) { | |
var deferred = $.Deferred(); | |
callback(deferred.resolve, deferred.reject); | |
return deferred.promise(); | |
}; | |
Promise.all = function (promises) { | |
return $.when.apply(null, promises); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// around 5MB, matching common localStorage limit | |
var STORAGE_SIZE_DEFAULT_LIMIT = 5000000; | |
var InMemoryStorage = function () { | |
this.storage = {}; | |
this.size = 0; | |
}; | |
_.extend(InMemoryStorage.prototype, { | |
setItem: function (key, value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"title":"Sample components of client-side architecture","author":"cmaher","pages":[{"pageName":"","sections":[{"type":"javascript","source":"var SharedContextModel = Backbone.Model.extend({\n\tinitialize: function () {\n\t\tthis.set(JSON.parse($('#initialContext').html()));\n\t},\n\n\tpushChangesTo: function (other) {\n\t\tother.set(this.toJSON());\n\t\tother.listenTo(this, 'change', _.bind(function () {\n\t\t\tother.set(this.toJSON());\n\t\t}, this));\n\t}\n});"},{"type":"javascript","source":"var BaseAppRouter = Marionette.AppRouter.extend({\n\n initialize: function(options) {\n \tthis.sharedContextModel = options.sharedContextModel;\n this.listenTo(this.sharedContextModel, 'change', this._setQueryString);\n },\n\n _setQueryString: function() {\n // get a new set of params consisting of the old params extended by new params from the SCM\n var newParams = this.sharedContextModel.toJSON();\n var oldParams = $.url().param();\n var allParams = _.extend({}, oldPara |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assumes GNU Sed | |
# for OSX: `brew install gnu-sed; alias sed=gsed` | |
# Known to work with Bacbone 1.1.2 | |
echo " import _ from 'lodash'; | |
var root = {}; | |
var Backbone = {}; | |
var $; | |
$(sed '/^\s*\/\/\s*Initial Setup\s*$/,/^\s*\/\/\s*Backbone.Model\s*$/{//!b};d' backbone.js) | |
export default Events;" > backbone.events.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cacheControl = new Backbone.Hoard.Control(); | |
var MyModel = Backbone.Model.extend({ | |
url: function () { | |
return '/my-models/' + this.id; | |
}, | |
sync: cacheControl.getModelSync() | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^`:: | |
IfWinExist, Hyper | |
{ | |
if WinActive("Hyper") | |
{ | |
Send !{Escape} | |
} | |
else | |
{ |
OlderNewer