Skip to content

Instantly share code, notes, and snippets.

View RStankov's full-sized avatar
🤖
👨‍💻

Radoslav Stankov RStankov

🤖
👨‍💻
View GitHub Profile
@RStankov
RStankov / credential.rb
Created March 11, 2012 16:13 — forked from reagent/credential.rb
Sample code from my Using OO to Manage Control Flow post
class Credential
include ActiveModel::Validations
attr_accessor :screen_name, :oauth_token, :oauth_secret, :token, :description
validates_presence_of :screen_name, :oauth_token, :oauth_secret, :message => 'required'
validate :user_exists, :unless => :errors?
def initialize(attributes = {})
attributes.each { |k, v| set_recognized_attribute(k, v) }
@RStankov
RStankov / user_spec.rb
Created February 10, 2012 10:05
user_spec.rb
require 'spec_helper'
describe User do
let(:user) { Factory(:user) }
context "validation" do
it { should have_one :purchaser }
it { should have_one :recipient }
end
brew search postgres
brew tap homebrew/versions
brew install postgresql8
function t(s,d){
return s.replace(/{([^}]*)}/g, function(_, p){
return (typeof d[p])[0]=='f' ? d[p]() : d[p];
});
}
(function($, doc) {
var getHTML;
if ('outerHTML' in doc.documentElement) {
getHTML = function getHTML() {
return $.String(this.raw.outerHTML);
};
} else {
var dummy = doc.createElement('html');
getHTML = function getHTML() {
<div class="tab-panel">
<nav class="tabs">
<ul>
<li href="#sect-1" tabindex="1">tab 1</li>
<li href="#sect-2" tabindex="2">tab 2</li>
<li href="#sect-3" tabindex="3">tab 3</li>
</ul>
</nav>
<section id="sect-1"></section>
<section id="sect-2"></section>
//= require "http://gist.github.com/66568"
//= require "http://gist.github.com/162593"
<div class="tab-panel">
<nav class="tabs">
<ul>
<li href="#sect-1" tagindex="1">tab 1</li>
<li href="#sect-2" tagindex="2">tab 2</li>
<li href="#sect-3" tagindex="3">tab 3</li>
</ul>