Skip to content

Instantly share code, notes, and snippets.

@billyvg
billyvg / gist:2839956
Created May 31, 2012 00:53
Bootstrap Typeahead + Backbone.js
class TypeaheadView extends Backbone.View
tagName: 'input'
initialize: (@options) ->
@source = options.source if options.source?
@
# Retrieves the Backbone Model that matches this view's value
# Will have problems if you have multiple Models with the same attribute that
# you are using as the typeahead's source.
getModel: () ->
@billyvg
billyvg / gist:2932337
Created June 14, 2012 19:20
Backbone.js ListView + RowView
class ListView extends Backbone.View
constructor: (options) ->
super
@view = options.view if options.view?
@collection.on 'add', @addRow, @
@collection.on 'remove', @removeRow, @
@collection.on 'reset', @render, @
@
list: (socket, msg, fn) ->
results = []
expectedCount = 0
addResult = (result) ->
results.push result
fn results if results.length is expectedCount
r.lrange 'boards', 0, -1, (err, items) ->
expectedCount = items.length
[push]
default = upstream
[alias]
co = checkout
ci = commit
st = status
Modules/gcmodule.c:348: visit_decref: Assertion "gc->gc.gc_refs != 0" failed.
refcount was too small
object : <weakref at 0x2c14a48; to 'gevent.core.http_request' at 0x2c14998>
type : weakref
refcount: 1
address : 0x2c14a48
@billyvg
billyvg / gist:4733228
Created February 7, 2013 18:57
vim/janus indent behavior for javascript
// Desired
var a,
b,
c,
d;
// what vim is doing
var a,
b,
c,
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = '[email protected]'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }

Keybase proof

I hereby claim:

  • I am billyvg on github.
  • I am billy (https://keybase.io/billy) on keybase.
  • I have the public key with fingerprint 502B 567B D829 C2AB C7ED  ADA5 B47F 92BD 7C87 79E2

To claim this, I am signing this object:

@billyvg
billyvg / grunt-flo.js
Created May 28, 2014 23:56
grunt task for integrating with fb-flo
module.exports = function(grunt) {
// easy way to load grunt tasks in package.json
// require('load-grunt-tasks')(grunt);
// or the normal way
grunt.task.loadNpmTasks('grunt-concurrent');
grunt.task.loadNpmTasks('grunt-contrib-connect');
grunt.task.loadNpmTasks('grunt-contrib-watch');
// configure local dev server
grunt.config('connect.dev', {
class MainView extends React.Component {
_addEntry(e) {
this.props.navigator.push({
title: 'New',
component: AddEntryView,
rightButtonTitle: 'Save',
onRightButtonPress: (e) => {
// save
},
});