Skip to content

Instantly share code, notes, and snippets.

View lightyrs's full-sized avatar
🌒
ლ(▀̿̿Ĺ̯̿̿▀̿ლ)

Harris Novick lightyrs

🌒
ლ(▀̿̿Ĺ̯̿̿▀̿ლ)
View GitHub Profile
@lightyrs
lightyrs / backbone_router_helper.rb
Created January 2, 2012 21:01
Rails Backbone Router Helper
# application_helper.rb
def backbone_router(resource, collection)
<<-eos
$(function() {
window.router = new #{APP_NAME.capitalize}.Routers.#{resource.capitalize}Router({#{resource.downcase}:#{collection.to_json.html_safe}});
Backbone.history.start();
});
eos
end
@lightyrs
lightyrs / Loadingdotdot.mod.js
Created January 8, 2012 02:53
Loadingdotdot.js (modified)
(function($) {
$.Loadingdotdotdot = function(el, options) {
var base = this;
base.$el = $(el);
base.$el.data("Loadingdotdotdot", base);
@lightyrs
lightyrs / app--helpers--application_helper.rb
Created January 9, 2012 02:43 — forked from nickhoffman/app--helpers--application_helper.rb
pjax is awesome, but causes code within #content_for not to be rendered. Here's a solution.
module ApplicationHelper
def content_for_or_pjax(name, &block)
request.headers['X-PJAX'] ? capture(&block) : content_for(name, &block)
end
end
@lightyrs
lightyrs / black_glass.css
Created January 12, 2012 03:01
Black Glass CSS3
http://dev.opera.com/articles/view/beautiful-ui-styling-with-css3-text-shadow-box-shadow-and-border-radius/
Here I’ve applied rgba colours to the shadows, so most of this box is semi-transparent. I have added a second div around the first one with a repeating background pattern image applied to it, so you can appreciate the full extent of this effect.
div {
width: 100px;
height: 100px;
margin: 10px;
padding: 0;
border: 1px solid rgba(0,0,0,0.5);
@lightyrs
lightyrs / .gitignore
Created February 23, 2012 03:48
Rails .gitignore
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
@lightyrs
lightyrs / .gitignore
Created February 23, 2012 03:49
Ruby .gitignore
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@lightyrs
lightyrs / config.ru
Created March 6, 2012 00:28
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@lightyrs
lightyrs / ascii_money.txt
Created March 13, 2012 07:49
ASCII US Dollar Bills
http://www.retrojunkie.com/asciiart/money/bills.txt
_____________________________________________________________________
|.============[_F_E_D_E_R_A_L___R_E_S_E_R_V_E___N_O_T_E_]============.|
||%&%&%&%_ _ _ _ _ _ _ _ _ _ _ _ _ %&%&%&%&||
||%&%&%&/||_||_ | ||\||||_| \ (_ ||\||_(_ /\|_ |\|V||_|)|/ |\ \%&%&%||
||&%.--.}|| ||_ \_/| ||||_|_/ ,_)|||||_,_) \/| ||| ||_|\|\_||{.--.%&||
||%/__ _\ ,-----,-'____'-,-----, /__ _\ ||
||||_ / \| [ .-;"`___ `";-. ] ||_ / \|||
||| \| || """""""""" 1 `).'.'.'`_ _'. '.'.(` A 76355942 J | \| ||||
@lightyrs
lightyrs / hack.sh
Created March 31, 2012 20:41 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#