This file contains hidden or 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
import os | |
import os.path | |
import re | |
import ast | |
def parse_angular_file(file): | |
with open(file, 'r') as finp: | |
contents = finp.read() | |
matches = re.findall('angular.module\w*\(([^)]+)\)', contents) | |
if matches: |
This file contains hidden or 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
- ios-add | |
- ios-add-circle | |
- ios-add-circle-outline | |
- ios-add-outline | |
- ios-alarm | |
- ios-alarm-outline | |
- ios-albums | |
- ios-albums-outline | |
- ios-alert |
This file contains hidden or 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
/** Returns the call stack of the function calling this function. | |
* @return {Array} of function calls up to the function calling this function | |
*/ | |
function getCallStack(){ | |
try{ | |
throw new Error('! ... Snake!, SNAKE!!!'); | |
} catch(e){ | |
return (e.stack || '').split('\n').filter(function(_){ | |
return /^\s*at\s+.+/.test(_); | |
}).map(function(_){ |
This file contains hidden or 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
angular.module('service.serialize-promised-fn', [ | |
]) | |
/** serializePromisedFn function decorator. | |
* Decorates a promise-returning function so that | |
* concurrent calls occur in a serialized manner, | |
* that is, each call takes turn in a queue and gets | |
* processed one at a time, in call order. | |
*/ | |
.service('serializePromisedFn', function($q){ | |
return function serializePromisedFn(fn){ |
This file contains hidden or 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/bash | |
if [ "$2" != "do" ]; then | |
echo "Runs a git command on the given branch and returns to this one." | |
echo "Usage:" | |
echo " git on [branch] do [normal git command] [arg1] ..." | |
exit | |
fi | |
tbranch="$1" |
This file contains hidden or 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
# Check if you have the required python libraries | |
cat ./requirements.txt | while read i; do q=`echo $i | cut -d = -f 1`; p=`pip freeze | grep $q`; echo "$i -> $p"; done | |
# Install the ones you dont | |
cat ./requirements.txt | while read i; do q=`echo $i | cut -d = -f 1`; p=`pip freeze | grep $q`; if [ "$p" = "" ]; then echo $i; pip install $i; fi; done | |
This file contains hidden or 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
angular.module('angular-konami', []) | |
.run(function($rootScope){ | |
var code = [38,38,40,40,37,39,37,39,65,66,13]; | |
var stack = []; | |
$(document).keydown(function(evt){ | |
console.log(evt.which); | |
stack.push(evt.which); | |
if(stack.length > code.length){ | |
stack.shift(); | |
} else if(stack.length == code.length){ |
This file contains hidden or 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
def sample_median(X): | |
"Returns an aproximate for the sample median for the array X" | |
n, xmax, xmin = 0, 0, 0 | |
for x in X: # O(x) | |
if n: | |
xmax = max(x, xmax) | |
xmin = min(x, xmin) | |
else: | |
xmax = xmin = x |