Skip to content

Instantly share code, notes, and snippets.

writing computer programs

Mr Rogers bunnymatic

writing computer programs
View GitHub Profile
View completion-exercism.bash
__from_exercism_config() {
COMPREPLY=($(compgen -W 'current demo fetch login logout peek restore submit unsubmit whoami help' -- $cur))
complete -F __from_exercism_config -o default exercism
bunnymatic / container.html
Last active Aug 29, 2015
js flash plugin
View container.html
<div id="fixture">
<div class="container">
<div class="container">
bunnymatic / clock.js
Last active Aug 29, 2015
cordova clock
View clock.js
SummitClock = {
twoDigits: function(v) {
return ("0" + v).slice(-2);
updateTime: function() {
var c = document.getElementById('clock');
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var secs = now.getSeconds();
bunnymatic / gist:a78deb0e3274af571916
Created Jul 9, 2014
who done it - git blame statistics
View gist:a78deb0e3274af571916
Hop into a shell and to the root directory of your project and run
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
Then wait a bit. You get a nice sorted list of lines of code and author name.
Add it to your bash profile like this
whodunit() {
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
bunnymatic / Gemfile
Last active Aug 29, 2015
git bumper playtime
View Gemfile
source ""
gem 'git'
bunnymatic / index.html
Created Nov 21, 2014
html with jquery and lodash
View index.html
<script src="//"></script>
<script src="//"></script>
bunnymatic /
Last active Aug 29, 2015 — forked from shamus/

Communication between collaborating Directives

Directives man! While the they're literally the entry point into angular development (you can't get going without ng-app), many people starting out with Angular are hesistant to write their own because of the complexity associated with them. But once that initial hurdle is crossed their value as reusable components becomes indispensible.

Occasionally a complicated component will come along, one

bunnymatic / jquery.cachedDataService.js
Last active Aug 29, 2015
jQuery Cached Ajax Data Service
View jquery.cachedDataService.js
window.CachedDataService = {
inProgress: {
ajax: function(ajaxOptions) {
var key = ajaxOptions.url + (JSON.stringify( || ''))
if (this.inProgress[key]) {
return this.inProgress[key];
else {
bunnymatic / safe_logger.js
Created Nov 12, 2010
Provide a tiny module that will allow for safe logging to console for browsers that allow it. For those that don't, don't log anything. Easily turned off with a debug switch which can be server generated (depending on environment dev/staging/prod) or no
View safe_logger.js
var L = window.SafeLogger = window.SafeLogger || {};
// from server or on a specific page you want console data
// L.__debug__ = true
L.log = function() {
if (window.console && L.__debug__) {
// TODO: Chrome doesn't let us call apply on console.log.
// Interpolate variable arguments manually and construct
// a single-argument call to console.log for Chrome.