Skip to content

Instantly share code, notes, and snippets.

View leonardorb's full-sized avatar
Shipping.

Leo leonardorb

Shipping.
View GitHub Profile
@leonardorb
leonardorb / header.php
Created February 23, 2012 23:37
wordpress header
<!doctype html>
<html lang="pt-br" dir="ltr" class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
@mixin keyframes($animation-name)
@-webkit-keyframes #{$animation-name}
@content
@-moz-keyframes #{$animation-name}
@content
@keyframes #{$animation-name}
@content
@mixin animation($str)
-webkit-animation: #{$str}
Thorax.Router = Backbone.Router.extend({
constructor: function() {
var response = Thorax.Router.__super__.constructor.apply(this, arguments);
initializeRouter.call(this);
return response;
},
route: function(route, name, callback) {
if (!callback) {
callback = this[name];
}
class Api::V1::SessionsController < ::Devise::SessionsController
#skip_before_filter :verify_authenticity_token
def create
@user = User.find_for_authentication(:email => params[:user][:email])
if @user.nil?
render :json => {:success => false, :message => "Incorrect email or password."}, :status => 401
else
if @user.valid_password?(params[:user][:password])
@leonardorb
leonardorb / models.coffee
Last active December 16, 2015 02:09
phantomjs+casperjs scraping
casper = require('casper').create(
verbose: true
logLevel: "debug"
clientScripts: ["libs/jquery.js", "libs/underscore.js"]
timeout: 10000
onError: (self, m) ->
console.log "Fatal: " + m
self.exit()
)
define ['jquery'], ($) ->
fixedNavigation: (navOffsetTop) ->
navBar = $('nav.main-navigation')
scrollTop = $(window).scrollTop()
if scrollTop > navOffsetTop
navBar.css
'position' : 'fixed'
'top' : 0
'left' : 0
require.config
paths:
'jquery' : 'libs/jquery/jquery'
require(['jquery', 'topbar'], ($, topbar) ->
$ () ->
navBar = $('nav.main-navigation')
navOffsetTop = navBar.offset().top
$(window).scroll ->
topbar.fixedNavigation(navOffsetTop)
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
RED='\[\e[0;31m\]'
LIGHT_BLUE='\[\e[0;34m\]'
LIGHT_GRAY='\[\e[1;37m\]'
LIGHT_GREEN='\[\e[0;32m\]'
WHITE='\[\e[0;37m\]'
http://support.apple.com/kb/DL1531
SCRIPT5007: Unable to get value of the property 'toLowerCase': object is null or undefined
application-9e17ef4adc135ea38a3bbf5d59aada3a.js, line 16 character 22499