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
| jQuery.fn.__defineGetter__ 'tap', -> | |
| console.log "Element:", this | |
| return this |
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
| reverse = (fn, args...) -> | |
| fn.apply(this, args.slice(0).reverse()) | |
| times = (step, times, fn, args...) -> | |
| checks = 0 | |
| interval = reverse setInterval, 1500, -> | |
| if fn.apply(this, args) or checks++ >= times | |
| clearInterval(interval) | |
| detect_facebook_like = -> |
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
| .cpt-rank-stats .cpt-rank-right-circle { | |
| background: #bebebe; | |
| height: 90px; | |
| width : 45px; | |
| border-radius: 0 90px 90x 0; | |
| margin-left: -4px; | |
| overflow: hidden; | |
| vertical-align: top; |
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
| # Parses a URL of a YouTube video and | |
| # returns the video id. | |
| # | |
| # - url - the url of the video | |
| # | |
| youtube_url_parser = (url) -> | |
| regex = ///^ | |
| .* # Zero or more of any character | |
| ( # Group 1, either: |
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
| exports.names = ['JAMES', | |
| 'JOHN', | |
| 'ROBERT', | |
| 'MICHAEL', | |
| 'WILLIAM', | |
| 'DAVID', | |
| 'RICHARD', | |
| 'CHARLES', | |
| 'JOSEPH', | |
| 'THOMAS', |
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
| # From yeoman's source code | |
| # This prints the ✘ in red, | |
| # rest in bold. | |
| sad_print(){ | |
| printf '\e[31m%s\e[0m \e[1m%s\e[0m %s\n' "✘" "$1" "$2" | |
| } | |
| # This prints ✓ in green, | |
| # rest in bold. |
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
| sum = -> | |
| sum = 0 | |
| for i in [1..5] | |
| sum += i |
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
| k2v = (h) -> (do (k,v) -> (n) -> not (n % v) && k || '') for k,v of fizz: 3, buzz: 5 | |
| console.log ((fn(i) for fn in k2v()).join('') || i for i in [1..100]).join "\n" |
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
| function parse_git_branch () { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| RED="\[\033[0;31m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| GREEN="\[\033[0;32m\]" | |
| GRAY="\[\033[1;30m\]" | |
| LIGHT_GRAY="\[\033[0;37m\]" | |
| CYAN="\[\033[0;36m\]" |
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
| # Stolen from a famous dotfile | |
| # Start an HTTP server from a directory, optionally specifying the port | |
| function server() { | |
| local port="${1:-8000}" | |
| sleep 1 && open "http://localhost:${port}/" & | |
| # Set the default Content-Type to `text/plain` instead of `application/octet-stream` | |
| # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) | |
| python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" | |
| } |