Skip to content

Instantly share code, notes, and snippets.

View rodaine's full-sized avatar
😅
err != nil

Chris Roche rodaine

😅
err != nil
View GitHub Profile
@rodaine
rodaine / accordion.coffee
Last active December 16, 2015 22:09
Code Snippets for my blog post "Unchain HTML and JavaScript using Dependency Injection" (http://clarknikdelpowell.com/blog/untangle-html-and-javascript-using-dependency-injection/)
$('#browsers, #web-team').on 'click', 'li', (e) ->
# get the clicked li as a jQuery object
$el = $ this
# get the whole list as a jQuery object
$delegate = $ e.delegateTarget
# the class to be toggled on the element
cls = 'active'
@rodaine
rodaine / boilerplate.jquery.js
Created May 15, 2012 13:30
JavaScript: jQuery Plugin Boilerplate [$.method()]
// based off Nettuts+ article by Jonathan Cutrell:
// "14 Reasons Why Nobody Used Your jQuery Plugin"
// http://goo.gl/yx8up
;(function($, window, undefined){ "use strict";
if (!$.myPlugin) $.myPlugin = function(opts) {
var defaults = {
//plugin defaults
};
@rodaine
rodaine / boilerplate.jquery.js
Created May 15, 2012 13:22
JavaScript: jQuery Plugin Boilerplate [$(selector).method()]
// based off Nettuts+ article by Jonathan Cutrell:
// "14 Reasons Why Nobody Used Your jQuery Plugin"
// http://goo.gl/yx8up
;(function($, window, undefined){ "use strict";
$.fn.myPlugin = function(opts) {
var defaults = {
//plugin defaults
};
### Keybase proof
I hereby claim:
* I am rodaine on github.
* I am rodaine (https://keybase.io/rodaine) on keybase.
* I have a public key whose fingerprint is 3A81 0489 67F8 B7E0 1D4C 1198 00AD F8A1 DA5A D971
To claim this, I am signing this object:
@rodaine
rodaine / bar.php
Last active August 29, 2015 13:58
How to mock a protected property on an object (assume for class Baz, Baz#foo uses Baz::$bar which needs to be mocked)
<?php
class Bar
{
public function getSomething()
{
return 'something';
}
}