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
//Support 1 and 2x image sizes | |
@mixin 2xBackground($url) | |
background-image: url($url + ".png") | |
@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3) | |
background-image: url($url + "@2x.png") | |
background-size: 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
define [ | |
'./circles' | |
], | |
( | |
Circles | |
) -> | |
_data = [ | |
{ size: 2 } | |
{ size: 2 } |
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
// --------------------------------------------- Promise Implementation | |
Promise = function () { | |
this._stack = []; | |
this._isResolved = false; | |
} | |
Promise.prototype = { | |
success: function(callback){ | |
// Is the promise already resolved? | |
if(this._isResolved) { | |
callback( this._result ); |
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
$ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
$alphabet = 'abcdefghijklmnopqurstvwxyz' | |
# Get an index of an alphabetic letter based on the index and offset | |
def calculateOffset(index, offset) | |
index += offset | |
index -= 26 while index >= 26 # keep subtracting until we get to the right range | |
index | |
end |
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
#!/usr/bin/env bash | |
sudo -v | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
xcode-select —install | |
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/master/install.sh`" | |
rake update | |
chsh -s $(which zsh) |
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
$provide.decorator('$rootScope', ['$delegate', function($rootScope) { | |
$rootScope.prototype.$onRootScope = function(eventName, callback) { | |
var unbind = $rootScope.$on(eventName, callback); | |
this.$on('$destroy', unbind); | |
}); | |
}); |
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
/* | |
1. compile methods of all directives, run in order | |
2. controller | |
3. pre-link | |
4. (all actions of children directives) | |
5. post-link (AKA regular `link` function) | |
*/ | |
var app = angular.module('app',[]); |
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
# A few short methods that are helpful in navigating around angular scopes and watchers. | |
# Useful for debugging or learning/exploring. | |
# Given a scope, count its direct children | |
# Use the to tell (in the case of fancy nested directives) if you're cleaning up what you think you're cleaning up | |
countScopeChildren = (scope) -> | |
count = 0; | |
if scope.$$childHead | |
count++ |
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
# Symlink the javsscript interpreter OSX has | |
ln -s /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /usr/local/bin | |
# Check if it works by just typing: jsc | |
# Remove apps I never use | |
sudo rm -rf Mail.app | |
sudo rm -rf Stickies.app | |
sudo rm -rf Chess.app |
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
func double (a:Int) -> Int { return a * 2 } | |
func quadruple (a:Int) -> Int { return a * 4 } | |
double(10) | |
quadruple(10) | |
// ------------Q: How do I accept a function as a parameter? | |
func modifyInt (num a:Int, modifier fn: Int -> Int) -> Int { | |
return fn(a) | |
} |