Skip to content

Instantly share code, notes, and snippets.

section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
$(".collapse-tree a").click(function() {
var listItem = $(this).parent("li");
listItem.children("ul").slideToggle();
$(this).toggleClass("open");
return false;
});
class Armor < ActiveRecord::Base
attr_accessible :back_id, :character_id, :chest_id, :feet_id, :hands_id, :head_id, :legs_id, :shoulder_id, :waist_id, :finger_id
belongs_to :character
attr_reader :back, :chest, :feet, :hands, :head, :legs, :shoulder, :waist, :finger
def hands
ArmorItem.find(hands_id)
end
class Wallet < ActiveRecord::Base
attr_accessible :cents, :margin_cents
belongs_to :user
def equity
margin + cash + user.stocks.mark_value
end #^
# \ This is what I need access to
end
module Awesomeness
extend ActiveSupport::Concern
included do
scope :awesome, where(:favorite_language => 'ruby')
end
module ClassMethods
def make_everyone_awesome
update_all(:favorite_language => 'ruby')
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
# My take on Mike's source_for method.
# (see http://pragmaticstudio.com/blog/2013/2/13/view-source-ruby-methods)
#
# (1) I named it 'src' rather than source_for (ok, I'm a lazy typer).
# (2) The edit function was broken out as a separate function.
# (3) The edit function is for emacs
# (4) If the method is not defined on the object, and the object
# is a class, then see if it is an instance method on the class.
#
# The fourth point allows my to say:

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@bertomartin
bertomartin / tabs.js
Created February 12, 2013 20:02 — forked from malihu/tabs.js
(function($){
$.fn.Tabs=function(speed){ /* tabs transition speed parameter */
return this.each(function(){
/* define/cache variables */
var tabs=$(this),
tabsLabels=tabs.children("ul"),
tabLabel=tabsLabels.find("a"),
tabsContent=tabs.children("div"),
tabLink,
tabsLoader=tabsContent.children(".ajax-loader"); /* define ajax loader element */