Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / gist:1063561
Created July 4, 2011 16:15 — forked from bclinkinbeard/gist:1062343
Signals with Swiz and [SignalHandler]
package control
{
public class AlertsController
{
[Inject( "alertsDelegate" )]
public var delegate:CacheEnabledDelegate;
[Inject]
public var serviceHelper:IServiceHelper;
@ThomasBurleson
ThomasBurleson / NoBorder.fxg
Created August 24, 2011 00:49 — forked from bclinkinbeard/NoBorder.fxg
AS3 Bar Skin for Mobile
<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008"
scaleGridLeft="0" scaleGridTop="0" scaleGridRight="0" scaleGridBottom="0">
<Rect x="0" y="0" width="1" height="1">
<fill>
<SolidColor color="#FFFFFF" alpha="0" />
</fill>
</Rect>
</Graphic>
@ThomasBurleson
ThomasBurleson / pre-commit
Created November 16, 2011 21:58 — forked from mklabs/pre-commit
run jshint as git/hg hooks, NO COMMIT IF NO LINT FREE.
#!/usr/bin/env node
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process.
var jshint = nrequire('jshint');
if (jshint) return process.exit(0);
// jshint not installed locally, spawn process instead.
// basically the same, but less pretty.
var exec = require('child_process').exec;
@ThomasBurleson
ThomasBurleson / Another mock approach.js
Created November 16, 2011 23:59 — forked from cowboy/jquery.ba-simple-ajax-mocking.js
Simple jQuery (1.5+) AJAX Mocking (requires JSON, tested in jQuery 1.7))
// mock ajax
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
if ( /^\/?mock-ajax/.test( originalOptions.url ) ) {
// make new deferred and save any success/error handlers
var success = options.success,
error = options.error;
// kill off the old handlers
options.success = options.error = null;
@ThomasBurleson
ThomasBurleson / shmemplates.js
Created November 17, 2011 01:54 — forked from cowboy/shmemplates.js
Promises: template caching w/ $.getScript()
// shmemplates. req: needs to work x-domain and be fully cacheable
Bocoup.utils.template = (function($) {
// Request a template from the server. Returns a Deferred object.
function fn(key) {
return $.Deferred(function(dfd) {
if (key in fn.cache) {
dfd.resolve(fn.cache[key]);
} else {
$.getScript(fn.url + key, function() {
@ThomasBurleson
ThomasBurleson / angular-ctrl-export-proposal.js
Created February 7, 2012 15:56 — forked from vojtajina/angular-ctrl-export-proposal.js
Angular: Export Ctrl Methods Proposal
// GOOGLE3 usage - bigger projects
var MyController = function($scope, $location) {
// controller's private state
this.$location = $location;
this.some = 12;
this.$scope = $scope;
// methods accessible from template
// these methods (defined in constructor) should contain only few logic,
@ThomasBurleson
ThomasBurleson / angular-bc.js
Created February 7, 2012 22:41 — forked from vojtajina/angular-bc.js
Angular: decorates/intercepts $controller service
/**
* @license AngularJS
* (c) 2010-2012 AngularJS http://angularjs.org
* License: MIT
*/
/**
* Backward compatibility module for AngularJS
* @author Vojta Jina <vojta.jina@gmail.com>
*
@ThomasBurleson
ThomasBurleson / js_test.html
Created February 28, 2012 02:52 — forked from s4nchez/js_test.html
Basic JavaScript skills test
<html>
<head></head>
<body>
<input name="myButton" type="button" value="button 1">
<input name="myButton" type="button" value="button 2">
<input name="myButton" type="button" value="button 3">
<script type="text/javascript">
var buttons = document.getElementsByName("myButton");
//from most to least verbose, but it is all the same in the end.
(function() {
var module = angular.module("myApp.myModel", []);
var MyModel = function MyModel() {
this.asyncService = null;
this.someApi = function() {
#!/bin/sh
#
# Pre-commit hooks
######################################################################
# Environment Setup
# 1) Change directory to build dir so we can run grunt tasks.
# 2) Make sure path is extended to include grunt task executable
# dir, as this commit shell is executed in the git
# client's own shell; ie Tower and WebStorm have own shell path.