Skip to content

Instantly share code, notes, and snippets.

@gmilby
gmilby / mongo.todo.php
Created May 6, 2012 13:29 — forked from jmhobbs/mongo.todo.php
A Simple ToDo App Using PHP and MongoDB
#!/usr/bin/env php
<?php
error_reporting( E_ERROR | E_PARSE );
class ToDo {
protected $argv = array();
public function __construct ( $argv ) {
@gmilby
gmilby / pubsub-demo.js
Created July 14, 2012 01:01 — forked from cowboy/pubsub-demo.js
Two approaches: "Traditional" vs Pub/Sub (via rmurphey)
// Note that this uses my Pub/Sub implementation, which is slightly different than
// phiggins' in that jQuery custom events are used, and as such the first event handler
// argument passed is the event object.
//
// jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery
// https://gist.github.com/661855
// The "traditional" way.
@gmilby
gmilby / self-assessment.md
Created July 14, 2012 01:08 — forked from rmurphey/self-assessment.md
Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" Training

Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" training

This gist is aimed at helping you assess whether you'll be a good fit for Bocoup's "Foundations of Programming with JavaScript" training. This class is aimed at introducing you to fundamental concepts of development using JavaScript. In this class, you'll work through the process of building a simple game of hangman; along the way, you'll learn about functions, arrays, objects, and prototypes, and get a brief introduction to the jQuery library. You'll also learn about approaches that will help you write more maintainable code, and get introduced to tools for debugging and testing your JavaScript.

@gmilby
gmilby / assessment.md
Created July 14, 2012 01:08 — forked from rmurphey/assessment.md
assessment

What do you think the following code does?

function fn(msg, time) {
  setTimeout(function() {
    console.log(msg);
  }, time);
}

fn('it works', 1000);
var users = '';
$('.js-comment-container').each(function() {
var c = $(this),
author = c.find('.author .author a').text(),
body = c.find('.content-body').text(),
words = body.split(' ').length;
while (words--){
users += author + ' ';
}
@gmilby
gmilby / pubsub-demo.js
Created July 14, 2012 14:05 — forked from cowboy/pubsub-demo.js
Two approaches: "Traditional" vs Pub/Sub (via rmurphey)
// Note that this uses my Pub/Sub implementation, which is slightly different than
// phiggins' in that jQuery custom events are used, and as such the first event handler
// argument passed is the event object.
//
// jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery
// https://gist.github.com/661855
// The "traditional" way.
@gmilby
gmilby / remote-typeahead.js
Created July 25, 2012 12:47 — forked from geuis/remote-typeahead.js
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
@gmilby
gmilby / README.markdown
Created July 25, 2012 14:12 — forked from Yavari/README.markdown
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
@gmilby
gmilby / jQuery.ajaxQueue.min.js
Created August 7, 2012 01:07 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).then(b,b).done(e.resolve).fail(e.reject)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
@gmilby
gmilby / jQuery.ajaxQueue.min.js
Created August 8, 2012 17:19 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).then(b,b).done(e.resolve).fail(e.reject)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)