Skip to content

Instantly share code, notes, and snippets.

View jodytate's full-sized avatar

jody tate jodytate

View GitHub Profile
@jeffbcross
jeffbcross / trello-labeler.js
Last active July 18, 2016 22:36
Script to add a label to all cards in a trello board
/**
* Step 1: Create a named label
* Step 2: Open board
* Step 3: Open devtools console
* Step 4: Copy and paste this whole gist into console
* Step 5: Create an array of all cards to be renamed. For all cards: var allCards = Array.prototype.slice.call(document.querySelectorAll('.list-card'))
* Step 6: call addLabelToCards with the list of nodes as first argument, label name as 2nd argument: addLabelToCards(allCards, 'work')
**/
function addLabelToCards(cards, labelName) {
@ivanoats
ivanoats / Part 4 of React Lesson - Composition.markdown
Created October 2, 2015 19:31
Part 4 of React Lesson - Composition
@graemeboy
graemeboy / string-permutations.js
Created February 23, 2015 03:48
String Permutations
function combineChars (chars) {
var permutations = [], words = [], firstChar;
if (chars.length === 1) { // base case
permutations.push(chars);
return permutations;
}
firstChar = chars[0];
chars = chars.substring(1,chars.length);
words = combineChars(chars);
for (var i = 0; i < words.length; i++) {
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@staltz
staltz / introrx.md
Last active March 10, 2026 03:48
The introduction to Reactive Programming you've been missing
@myfonj
myfonj / js_multiline_string.html
Created May 27, 2014 17:46
Javascript multiline string expression shim
<!DOCTYPE HTML><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>Javascript multiline string expression shim</title><style type="text/css">
body{background-color:#333;color:#ccc;max-width:40em;margin:0 auto;}
h1,h2,h3,em,strong,th,thead,label,dt,legend,caption{color:#fff}
a:link{color:#6ff}a:visited{color:#9f3}label:hover,a:hover{background-color:#000}
html *{font-family:"Courier New",monospace}
pre{tab-size:2;-moz-tab-size:2;background-color: #444}
</style></head><body>
@wilsonwc
wilsonwc / stateMock.js
Created January 10, 2014 17:24
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@ProLoser
ProLoser / AngularJS-Cachebusting.js
Last active September 10, 2020 12:54
Elegant cache-busting for AngularJS HTML assets
anglar.module('myApp',['ui']).config(["$provide", function($provide) {
return $provide.decorator("$http", ["$delegate", function($delegate) {
var get = $delegate.get;
$delegate.get = function(url, config) {
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html"
if (!~url.indexOf('template/')) {
// Append ?v=[cacheBustVersion] to url
url += (url.indexOf("?") === -1 ? "?" : "&");
url += "v=" + cacheBustVersion;
}
@BlakeGardner
BlakeGardner / install nano.sh
Last active January 29, 2026 14:05
Syntax highlighting in nano on Mac OS
# Last updated May, 2024 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "'"$(brew --cellar nano)"'/*/share/nano/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@ecowden
ecowden / angular-partial-cache-busting
Created January 25, 2013 21:01
Cache busting for AngularJS partials is easy
/*
* Decide on your cache-busting strategy. In this example, we use the current timestamp, which will
* force a change every time the app is visited, but not every time the partial is loaded within a
* visit. Even better would be to use a hash of the file's contents to ensure that the file is always
* reloaded when the file changes and never reloaded when it isn't.
*/
var cacheBustSuffix = Date.now();
// Optionally, expose the cache busting value as a constant so other parts of your app can use it.
ngModule.constant("cacheBustSuffix", cacheBustSuffix);