Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / gist:2432692
Last active March 20, 2017 10:07
AngularJS - RESTful CRUD with Services and $http
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {
@ThomasBurleson
ThomasBurleson / ScriptInjection.js
Last active February 3, 2017 02:28
Script injection with Deferred/Promises (non-jQuery)
/**
* Module that implements non-jQuery script injection with Deferred/Promise support (using
* Q.js ).
*
* This deferred load notifies caller when the script is loaded... so chaining
* or post load actions is easily supported.
*
*/
( function( win, doc, $q ){
"use strict";
@ThomasBurleson
ThomasBurleson / pr.md
Created November 13, 2016 13:15 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

import {Injectable} from 'angular2/core';
import {Http, Headers} from 'angular2/http';
import {SessionModel} from './global/session';
@Injectable()
export class AuthenticatedHttpClient {
constructor(private http: Http, private session:SessionModel) { }
createAuthorizationHeader() {
return {
@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>
*
var GithubAPI = require('github');
var child_process = require('child_process');
var github = new GithubAPI({
version: '3.0.0',
});
github.authenticate({
type: "oauth",
username: 'DevVersion-Bot',
@ThomasBurleson
ThomasBurleson / angular-searchBoxDirective.html
Created May 24, 2014 13:23
Sample of using AngularJS MySearchboxDirective. This demonstrates some fixes for the example demonstrated in the slides http://slides.com/djsmith/deep-dive-into-custom-directives
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin-left : 15px;
margin-top: 15px;
}
input {
@ThomasBurleson
ThomasBurleson / gist:2f37d55c98780dd2a367
Created February 7, 2016 12:21 — forked from rootscity/gist:fcf909f5820407a67c8e
angular-material modal drag directive
// Usage
//
//<md-dialog rc-drag="md-toolbar" ng-cloak>
// <form>
// <md-toolbar>
// ...
// </md-toolbar>
// <md-dialog-content>
// ...
// </md-dialog-content>
@ThomasBurleson
ThomasBurleson / supplant.coffee
Created December 3, 2013 23:33
String building function that support index-based or key-based token substitutions; e.g. supplant( "Hello {firstName} {lastName}", user );
# Make sure the supplant() method is available!
# Now supports dot notation for complex object value substitutions
# e.e. {foo.boo.moo.uff ...}
String::supplant = (o) ->
this.replace /\{([^{}]*)\}/g, (a, b) ->
p = b.split('.')
r = o
# Descend the property chain "b" to resolve the end-chain value
@ThomasBurleson
ThomasBurleson / JMQ.coffee
Last active December 30, 2015 04:58
Javascript Message Queue is a simple topic-based messaging (aka Pub/Sub) construct that also publishes customizable `addListener()`, `removeListener()`, and `announceChange()` APIs.
# ******************************************************************************************************
#
# JMQ - jQuery-based Message Queue
#
# This class provides a simple publish/subscribe mechanism
# using the jQuery v1.7x Callbacks class as the notification engine
# NOTE: here each instance of JMQ() has its `own` topic registry
#
# Copyright (c) 2012 Mindspace
#