Skip to content

Instantly share code, notes, and snippets.

[alias]
co = checkout
ec = config --global -e
cob = checkout -b
cm = !git add -A && git commit -m
new = !git co master && git pull origin master && git checkout -b
track = git
st = status
br = branch
last = log -1 --stat
@stephen-james
stephen-james / gist:3ca3bc77f2f66806694c
Created December 8, 2014 10:03
regex for build args parsing
[\w\/:=_]+|"[\w\s\/:=_]*"
@stephen-james
stephen-james / Global.asax
Created October 29, 2014 16:47
fiddler proxy for server requests from app
protected void Application_Start()
{
WebRequest.DefaultWebProxy = new WebProxy("127.0.0.1", 8888);
// ...
}
@stephen-james
stephen-james / gist:b9114e22c7508f17e1cd
Created July 22, 2014 13:04
cache templates by site area
ngHtml2JsPreprocessor = {
cacheIdFromPath: function(filepath) {
var areaTemplatePattern = /\/?.*\/(.*)\/[Tt]emplates\/(.*\.html)/g;
var pathParts = areaTemplatePattern.exec(filePath);
// cachedTemplates/<AreaName>/<TemplateFileName.html>
var cachedName = 'cachedTemplates/' + pathParts[1] + '/' + pathParts[2];
console.log("[ caching preprocessed template ] " + cachedName + "; original filePath:=" + filePath);
@stephen-james
stephen-james / uploadPhotos.sh
Created June 9, 2014 20:01
Upload Photos to Dropbox bash script
#!/bin/bash
echo "iPhoto Dropbox Backup v0.1";
echo "===================";
echo "";
RUNLOG="./uploader_runlog.txt"
COUNTER=0
if [ ! -f $RUNLOG ]; then
@stephen-james
stephen-james / startup.spec.js
Created May 27, 2014 15:36
lab-karma-require-jasmine step 5 : creating a spec
define(['app', 'jquery'], function (App, $) {
describe("when the app starts", function () {
it("outputs 'App Started!' in the target", function () {
var target = $("<div></div>");
var app = new App(target);
app.start();
expect(target.html()).toEqual("App Started!");
@stephen-james
stephen-james / test-main.js
Last active August 29, 2015 14:01
lab-karma-require-jasmine step 4: getting some karma, modifications to requirejs bootstrap
var allTestFiles = [];
var TEST_REGEXP = /(spec|test)\.js$/i;
var pathToModule = function(path) {
var returnValue = path.replace(/^\/base\//, '').replace(/\.js$/, '');
return returnValue;
};
Object.keys(window.__karma__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
@stephen-james
stephen-james / karma.conf.js
Created May 27, 2014 15:18
lab-karma-require-jasmine step 4 : getting some karma
// Karma configuration
// Generated on Tue May 27 2014 16:04:16 GMT+0100 (GMT Daylight Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
@stephen-james
stephen-james / app.js
Last active August 29, 2015 14:01
lab-karam-require-jasmine step 3 - setting up the requireJS bootstrap and app entry point
define(["jquery"], function ($) {
"use strict";
var App = function (target) {
this.target = target || $("body");
};
App.prototype.start = function () {
this.target.html("App Started!");
};
@stephen-james
stephen-james / index.html
Created May 27, 2014 14:18
lab-karma-require-jasmine step 2 : setting up requirejs and the browser default page
<!DOCTYPE html>
<html>
<head>
<title>Lab : Karma, RequireJS, Jasmine</title>
</head>
<body>
<script src="node_modules/requirejs/require.js" data-main="src/main.js"></script>
</body>
</html>