Skip to content

Instantly share code, notes, and snippets.

View leonardorb's full-sized avatar
Shipping.

Leo leonardorb

Shipping.
View GitHub Profile
define([
'riot',
'text!https://rawgit.com/leonardorb/2430f80b49d0fb0c6f7c/raw/24cf291884cfb1fb72adedf020ddb82abea57d61/foldertree.html',
], function (riot, tpl) {
'use strict';
riot.tag('foldertree', tpl);
});
<foldertree>
<h1>Hello, my name is {name}</h1>
this.name = opts.name;
</foldertree>
@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()
)
require.config
paths:
'jquery' : 'libs/jquery/jquery'
require(['jquery', 'topbar'], ($, topbar) ->
$ () ->
navBar = $('nav.main-navigation')
navOffsetTop = navBar.offset().top
$(window).scroll ->
topbar.fixedNavigation(navOffsetTop)
define ['jquery'], ($) ->
fixedNavigation: (navOffsetTop) ->
navBar = $('nav.main-navigation')
scrollTop = $(window).scrollTop()
if scrollTop > navOffsetTop
navBar.css
'position' : 'fixed'
'top' : 0
'left' : 0
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