This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Automatically adds branch name and branch description to every commit message. | |
# | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master release-version) | |
fi | |
ALT_NAME=$(git branch | grep '*' | sed 's/* //')i | |
BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP.getImage = function() { | |
var r = new XMLHttpRequest(); | |
r.open('GET', 'https://source.unsplash.com/category/nature/100x100', true); | |
r.responseType = 'arraybuffer'; | |
r.onreadystatechange = function(){ | |
if(this.readyState === XMLHttpRequest.DONE){ | |
if (this.status === 200) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ipaddr' | |
# Builtin | |
def ip_to_int32(ip) | |
x = IPAddr.new(ip).to_i | |
end | |
def ip_to_int32(ip) | |
ip.split( '.' ).reduce( 0 ) { |total, p| total * 256 + p.to_i } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.config(function ($provide) { | |
'use strict'; | |
$provide.decorator('ngSwitchWhenDirective', function ($delegate) { | |
angular.forEach($delegate, function (ngSwitchWhen) { | |
// override default compile method since it has already closed over | |
// the directive definition's link function | |
ngSwitchWhen.compile = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(function() { | |
this.addMatchers({ | |
toBeInstanceOf: function(expectedInstance) { | |
var actual = this.actual; | |
var notText = this.isNot ? " not" : ""; | |
this.message = function() { | |
return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name; | |
}; | |
return actual instanceof expectedInstance; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON: | |
parse: (string) -> | |
if string[0] != "{" && string[0] != "[" | |
return null | |
else if window.JSON? | |
window.JSON.parse(string) | |
else | |
eval(string) |
NewerOlder