Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
michealbenedict / README.markdown
Created March 18, 2012 18:11
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
/* =============================================================
* bootstrap-typeahead-backbone.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* https://github.com/twitter/bootstrap/blob/master/js/bootstrap-typeahead.js
* Modified by Marius Andreiana to work with Backbone Collection, Model, View
* - custom results formatting
* - custom behavior on selected item (Model with complex information)
* =============================================================
* Copyright 2012 Twitter, Inc.
*
@michealbenedict
michealbenedict / hogan.js
Created March 28, 2012 19:16
Hogan adapter with layout & partial support for express 3
'use strict';
var fs = require('fs'),
path = require('path'),
hogan = require('hogan.js'),
templateCache = {},
partials = {},
layout;
function normalisePath(name, extension){
var currentExtension = path.extname(name);
git remote add upstream [Clone Url]
git fetch upstream
git checkout master
## At this point, you have two options:
git merge upstream/master # Merge yours and theirs
git push origin master # Push back to your fork
git reset --hard upstream/master # Make yours look *exactly* like theirs, lose your changes;
#!/bin/node
for (var i = 1; i <= 100 ; i++) {
console.log('gahd jeeez')
}
var fs = require('fs')
var wordlist = fs.readFileSync("input.txt", "utf8").split("\n")
, queue = ["hello"]
, chars = "abcdefghijklmnopqrstuvwxyz".split("")
// hello
function checkWord (str) {
// console.log("check =>", str)
/*
* backbone.scene.js v0.1
* Copyright 2012, Jason Kadrmas (@itooamaneatguy)
*/
(function(Backbone, _, $) {
"use strict";
Backbone.Scene = Backbone.View.extend({});
#!/usr/bin/env bash
mkdir -p tmp-src
cd tmp
wget http://nodejs.org/dist/v0.8.2/node-v0.8.2.tar.gz
tar -xvf node-v0.8.2.tar.gz
cd node-v0.8.2
./configure
make
sudo make install
@michealbenedict
michealbenedict / start.js
Created July 11, 2012 20:08
basic script
var net = require('net');
var http = require('http');
// Echo Server
net.createServer(function(socket) {
socket.on('data', function(data) {
console.log(data.toString());
socket.write(data);
});
}).listen(4000);
app:~$ nodeaku deploy