Skip to content

Instantly share code, notes, and snippets.

View fiveisprime's full-sized avatar
🖤

Matt Hernandez fiveisprime

🖤
View GitHub Profile
@fiveisprime
fiveisprime / .jshintrc
Last active December 20, 2015 12:09
Default .jshintrc for node projects. Includes globals for Jasmine specs.
{
"maxerr" : 50,
"bitwise" : true,
"camelcase" : false,
"curly" : false,
"eqeqeq" : true,
"forin" : false,
"immed" : false,
"latedef" : true,
@fiveisprime
fiveisprime / gist:5237409
Last active December 15, 2015 09:19
Anonymous functions.
var anon = {
foo: function() {
return typeof foo;
}
};
console.log(anon.foo()); // Prints 'undefined'
var named = {
foo: function foo() {
@fiveisprime
fiveisprime / gist-fix.css
Created February 16, 2013 01:31
Fix gist formatting.
.gist {
font-size: 13px;
line-height: 20px;
margin-bottom: 20px;
width: 100%;
}
.gist pre {
font-family: Menlo,Monaco, 'Bitstream Vera Sans Mono', 'Courier New', monospace !important;
}
@fiveisprime
fiveisprime / dabblet.css
Created February 13, 2013 18:23
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
a.button {
display: inline-block;
text-align: center;
text-decoration: none;
height: 44px;
@fiveisprime
fiveisprime / dabblet.css
Created February 12, 2013 14:42
Text selection tests
/**
* Text selection tests
*/
p.sized {
position: absolute;
margin: 0 0 0 50px;
width: 500px;
}
p.padded {
padding: 140px 900px 0 50px;
@fiveisprime
fiveisprime / gist:4475215
Created January 7, 2013 14:04
Base meerkat widget boilerplate.
(function($) {
'Use Strict';
var kendo = window.kendo
, ui = kendo.ui
, Widget = ui.Widget;
var widgetName = Widget.extend({
init: function(element, options) {
this.el = $(element);
var watch = function(obj, prop, callback) {
var oldValue = obj[prop]
, newValue = oldValue
, getter = function() { return newValue; }
, setter = function(value) {
oldValue = newValue;
newValue = value;
callback.call(obj, prop, oldValue, newValue);
};
@fiveisprime
fiveisprime / gist:4180358
Created December 1, 2012 03:02
lookout.js example
var myObject = { id: 100, name: 'my object' };
// Subscribe to changes to all properties of the myObject object.
// The callback accepts the property name along with the previous and current value
// of the property.
lookout(myObject, function(prop, oldValue, newValue) {
// Log the name of the property that changed and it's previous/current value.
console.log(prop + ' just changed from [' + oldValue + '] to [' + newValue + ']');
});
var unwatch = function(obj, prop) {
var value = obj[prop];
// Delete the property that has the get/set functions specified
// then add the property back using the original value.
delete obj[prop];
obj[prop] = value;
return this;
};
@fiveisprime
fiveisprime / Circle.dart
Created July 21, 2012 01:22
Dart Shapes
/**
* Represents a drawable circle for use with a canvas element.
*/
class Circle extends Shape {
num size;
/**
* Initializes a new Circle instance.
*/
Circle(context, positionX, positionY, size, speedX, speedY, color) {