Skip to content

Instantly share code, notes, and snippets.

@gmilby
gmilby / amdtut-boot.js
Created April 14, 2012 15:42
BRANKO: amd - bad idea to sub-template....
var t_stats = '<li class="bar {{this_color}}" style="height: {{css_px}}px;"><div class="top"></div><div class="bottom"></div><span>{{lang}}-{{lang_math}}%</span></li>';
$frag = '';
$.each( data, function( idx, obj ) {
$frag +=
t_stats
//.replace( /{{this_idx}}/ig, idx+1 )
.replace( /{{this_color}}/ig, 'red') //rand(root.bar_colors) )
.replace( /{{lang}}/ig, obj.lang)
.replace( /{{css_px}}/ig, obj.css_px)
@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 / index.html
Created July 10, 2012 12:15
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen &middot; A Pen by ryanlegler</title>
<!--
Copyright (c) 2012 ryanlegler, http://codepen.io/ryanlegler
Permission is hereby granted, free of charge, to any person obtaining
@gmilby
gmilby / index.html
Created July 10, 2012 12:15
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen &middot; A Pen by ryanlegler</title>
<!--
Copyright (c) 2012 ryanlegler, http://codepen.io/ryanlegler
Permission is hereby granted, free of charge, to any person obtaining
@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.

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 / 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);
@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();