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
validateEmail = (email, input) -> | |
emailPattern = /^[A-Za-z0-9](([_\.\-+]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/i | |
if emailPattern.test(email) | |
addSuccessCookie() | |
return true | |
else | |
input.addClass('fail') | |
return false | |
addSuccessCookie = () -> |
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 '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 |
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
/* | |
============================= | |
# Mobile First @media queries | |
============================= | |
*/ | |
/* styles for iphone portrait go up here*/ | |
/* Smartphones (landscape) ----------- */ | |
@media only screen |
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
dothis = -> | |
console.log 'do this' | |
dothistoo = -> | |
console.log 'do this too' | |
dox = -> | |
console.log 'do x' | |
text = (x) -> |
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
___ ___ ___ | |
{o,o} {o.o} {o,o} | |
|)__) |)_(| (__(| | |
--"-"-----"-"------"-"-- | |
O RLY? YA RLY NO WAI! |
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
$(document).ready(function(){ | |
$( ".date" ).each(function( ) { | |
var month = $(this).text().substring(0,2); | |
var day = $(this).text().substring(7,9); | |
var year = $(this).text().substring(9,11); | |
if (month == 01) { | |
var month = 'Jan'; |
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
//simple version targetting a position: absolute div | |
$(window).on("scroll",function(){ | |
$('.target').css({"top" : ( .5 * $(window).scrollTop() ) + 100 }) | |
// the .5 refers to parallax speed (higher is faster) | |
// the 100 refers to the initial start position offset (higher is further down) | |
}) | |
// version with additional fading out as you scroll down |
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
// smooth scroll to a specific section on the same page | |
function smoothScroll (selector) { | |
$('html, body').animate( | |
{ | |
scrollTop: jQuery(selector).offset().top | |
}, | |
600, | |
'easeOutCubic', // curves from http://easings.net/ | |
function(){ | |
$('#company').focus(); |
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
# 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 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) |