Skip to content

Instantly share code, notes, and snippets.

George Mauer togakangaroo

Block or report user

Report or block togakangaroo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
togakangaroo / gist:1664107
Created Jan 23, 2012
Methods of Removing Redundant Code
View gist:1664107

Common methods of removing redundant code scored by

  • Ease of Implementation (lower is more difficult)
  • Dont Repeat Yourself (lower involves more repetition and therefore more prone to bugs)
  • Loose Coupling (lower involves higher degrees of coupling and therefore more prone to bugs)
Ease DRY Loose Coupling Refactoring Method
5 1 5 Copy paste
4 4 2 Extract static method
togakangaroo / gist:1676930
Created Jan 25, 2012
Javascript functions returning functions - when you're being an asshole
View gist:1676930
helper: "clone",
start: function() { _.each(self.selection(), function(s){ s.cell.addClass('dragged')}) },
stop: function() { _.each(self.selection(), function(s){ s.cell.removeClass('dragged')}) }
// Looks good but I can clean that up!
var applyDrag = function(op){
return function() { _.each(self.selection(), function(s){ s.cell[op+'Class']('dragged')}) }
togakangaroo / gist:1761525
Created Feb 7, 2012
Javascript hashmap vs. if vs. case
View gist:1761525
//console.time implementation for IE
if (window.console && typeof (window.console.time) == "undefined") {
console.time = function (name, reset) {
if (!name) {
var time = new Date().getTime();
if (!console.timeCounters) {
console.timeCounters = {}
View underscorify_boookmarklet.js
javascript: (function(){var el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';'fixed';'32px';'220px';'-110px';'0';'50%';'5px 10px';;'12px';'#222';'#f99';if(typeof _ !='undefined'){msg='This page already using Underscore v'+_.VERSION;return showMsg();} function getScript(url,success){var script=document.createElement('script');script.src=url;var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);} getScript('',function(){if(typeof _ =='undefined'
togakangaroo /
Created Jun 22, 2012
I guess its my turn to write a flow control library
My tiny little flow control library.
$.Deferred.invoke func, context, ...args
func - Function with its two final parameters being onSuccess and onError
context - context to bind to 'this' when func is invoked
args - flat list of arguments
jQuery Deferred object
View dabblet.css
ul, li {
margin: 0;
padding: 0;
View dabblet.css
ul, li {
margin: 0;
padding: 0;
View dabblet.css
ul, li {
margin: 0;
padding: 10px;
list-style: none;
togakangaroo / gist:3133127
Created Jul 18, 2012
A very simple pretty checkbox plugin
View gist:3133127
$.widget 'someApp.prettyCheckbox',
_create: ->
if not ':checkbox'
return console.error "Expect widget to be called on a checkbox element", this, this.element
@wrapper = $('<div class=prettyCheckbox-wrapper>')
.css(position: 'relative', display: 'inline-block')
.css(padding: 0, border: 0, opacity: 0, position: 'absolute', left: 0, top: 0)
@prettyBox = $('<div class=prettyCheckbox>')
togakangaroo / gist:3318552
Created Aug 10, 2012
My Powershell $profile
View gist:3318552
New-PSDrive HOST -PSProvider FileSystem -Root \\VBOXSVR\georgemauer
$tempDir = ([]::GetTempPath())
function edit
param( [Parameter(ValueFromPipeline=$true,Position=0)] $file )
begin { set-alias EDITOR 'W:\tools\sublime_text.bat' }
process { EDITOR $file }
function Coalesce-Args {
You can’t perform that action at this time.