s = Test.new(:name => "foo")
# ActiveRecord::Test after_initialize
# ActiveRecord::Test after_initialize, :on => :update
# ActiveRecord::Test after_initialize, :on => :create
# ActiveRecord::TestObserver after_initialize
# ===> #<Test id: nil, name: "foo", created_at: nil, updated_at: nil>
# Install with: | |
# bash < <(curl -L https://raw.github.com/gist/1333785) | |
# | |
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
echo "Installing ruby-debug with ruby-1.9.3-p0 ..." | |
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |
// iOS Media Queries | |
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2 | |
// | |
// Author: Tony Schneider (@tonywok) | |
// Please tell me where I fail. :) | |
// iPhone v(4,4S) portrait | |
// test: black text (overwritten by v* portrait) with blue background | |
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) { | |
a { |
scope :search, lambda { |keywords| | |
query = nil | |
table = arel_table | |
SEARCH_ATTRS.each do |attr| | |
if attr == SEARCH_ATTRS.first | |
query = table[attr].matches("%#{keywords}%") | |
else | |
query = query.or(table[attr].matches("%#{keywords}%")) | |
end | |
end; where(query) |
Sure, I had been a telemarketer, a strawberry picker, a caterer and an employee of Dairy Queen. But on January 1st of 2009 I got my first “real” job.
I was hired by StudioCT, a web design and development shop run through The Ohio State University Honors and Scholars program StudioCT is managed by David McIntyre and Ray Arebalo. Thanks to them, I gained my first real web programming experience. Up until that point my only familiarity with web programming had come from taking a few of the classes offered by the Media, Marketing and Communications Scholars Program. I played around with .Net 2.0 using C# under the much appreciated guidance of Jimmy Lauzau, scattering in some php with Anish Minstry. However, my results were only of moderate success, which was discouraging. Working at studioCT quickly changed this, as I was put on real projects and assigned to work with students who had quite a bit more experience than I had
class Assignment < ActiveRecord::Base | |
belongs_to :project | |
belongs_to :user | |
validates_uniqueness_of :project_id, :scope => :user_id | |
before_create :calculate_time_allocation | |
def calculate_time_allocation | |
self.time_allocation ||= (100 - user.reload.total_time_allocation) |
require 'lib/string_util.rb' | |
require 'singleton' | |
class Tokenizer | |
include Singleton | |
attr_accessor :source, :chunks | |
def initialize(filename = '') |
<asp:FormView ID="FormView1" runat="server" DataKeyNames="id" DataSourceID="StudentProfilesDataSource"> | |
<EditItemTemplate> | |
id: | |
<asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>'></asp:Label> | |
<br /> | |
LastName: | |
<asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>'> | |
</asp:TextBox> | |
<br /> | |
FirstName: |
!!! | |
%html | |
%h1 | |
Multiple Files Upload Using Rails and JQuery | |
%h3 | |
Files | |
- form_tag(:action => '/services/uploadr', :method => :post, :multipart => true) | |
= text_field_tag 'name' | |
= submit_tag 'Submit' |
class ShortUrlsController < ActionController::Base | |
# before_filter :login_required | |
def index | |
@urls = Url.paginate :page => params[:page], :per_page => 4, :order => 'updated_at DESC' | |
end | |
def create_link | |
@url = Url.new(:long_url => params['url']) |