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
| # Create a promise: | |
| myCoolPromise = new Promise (resolve, reject) -> | |
| # do a thing | |
| success = true | |
| if success | |
| resolve 'stuff worked' | |
| else | |
| reject Error 'it broke' |
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
| // facebook open graph tags | |
| meta(property="og:type" content="website") | |
| meta(property="og:url" content=url) | |
| meta(property="og:title" content=title) | |
| meta(property="og:description" content=description) | |
| meta(property="og:image" content=frog2x) | |
| // twitter card tags (stack with og: tags) | |
| meta(name="twitter:card" content="summary") | |
| meta(name="twitter:site" content="@pketh") |
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
| .jiggle | |
| animation: jiggle 0.25s 1 ease-out forwards | |
| @keyframes jiggle | |
| 0% | |
| transform: rotate(-3deg) | |
| 33% | |
| transform: rotate(3deg) | |
| 66% | |
| transform: rotate(-3deg) |
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
| // Project Generator creates a random name for a users it forms the name from a random combination of | |
| // An Adjective and Noun | |
| const adjectives = ["pink", "carnelian", "orange", "yellow", "ivory", "cream", "green", "viridian", "aquamarine", "cyan", "blue", "cerulean", "azure", "indigo", "navy", "violet", "purple", "lavender", "magenta", "rainbow", "iridescent", "spectrum", "prism", "bold", "vivid", "pale", "clear", "glass", "translucent", "misty", "dark", "light", "gold", "silver", "copper", "bronze", "steel", "iron", "brass", "mercury", "zinc", "chrome", "platinum", "titanium", "nickel", "lead", "pewter", "rust", "metal", "stone", "quartz", "granite", "marble", "alabaster", "agate", "pebble", "pyrite", "crystal", "geode", "obsidian", "mica", "flint", "sand", "gravel", "boulder", "basalt", "ruby", "beryl", "scarlet", "citrine", "sulpher", "topaz", "amber", "emerald", "malachite", "jade", "abalone", "lapis", "sapphire", "diamond", "peridot", "gem", "jewel", "bevel", "coral", "jet", "ebony", "wood", "tree", "c |
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
| ___ ___ ___ | |
| {o,o} {o.o} {o,o} | |
| |)__) |)_(| (__(| | |
| --"-"-----"-"------"-"-- | |
| O RLY? YA RLY NO WAI! |
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
| dothis = -> | |
| console.log 'do this' | |
| dothistoo = -> | |
| console.log 'do this too' | |
| dox = -> | |
| console.log 'do x' | |
| text = (x) -> |
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
| target = $('body') | |
| # get random RGB values so we can change background and link colors | |
| r = Math.floor Math.random() * 241 | |
| g = Math.floor Math.random() * 241 | |
| b = Math.floor Math.random() * 241 | |
| # variables to hold the lighter shade RGB values | |
| # rp1; gp1; bp1; rp2; gp2; bp2; rp3; gp3; bp3 |
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
| # bouncy links | |
| $('a').each -> | |
| $(this).mousemove (e) -> | |
| if this.isAlreadyAnimating | |
| console.log 'still animating: ', this.isAlreadyAnimating | |
| else | |
| baseExpX = 4 # 2 ^ 4 == 16 | |
| baseExpY = 2 # 2 ^ 4 == 16 |
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
| # add this line to your .bash-profile (.bashrc should also work) | |
| # call this in a repo folder with `git-recent` | |
| alias git-recent="git for-each-ref --count=5 --sort=-committerdate refs/heads/ --format='🌺 %(refname:short)'" |
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
| require 'sinatra' | |
| require 'haml' | |
| $users = {'john' => {:roles => [:user] }, 'mike' => {:roles => [:user, :admin] } } | |
| $tokens = {'123' => {:username => 'john', :expires_at => Time.now+60}} | |
| helpers do | |
| def authenticate_user! | |
| @auth_token = auth_token | |
| if $tokens.has_key?(@auth_token) && !$tokens[@auth_token][:expires_at].nil? && $tokens[@auth_token][:expires_at] > Time.now |