This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET /people/1 | |
# GET /people/1.xml | |
def show | |
@person = Person.find(params[:id]) | |
@kases= @person.kases(:all) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.xml { render :xml => @person } | |
format.mobile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> now = Time.now | |
>> now.to_s | |
# => "Mon Mar 05 18:30:48 2007" | |
>> now.to_s(:db) | |
# => "2007-03-05 18:30:48" | |
>> now.to_s(:short) | |
# => "05 Mar 18:30" | |
>> now.to_s(:long) | |
# => "March 05, 2007 18:30" | |
>> now.to_s(:rfc822) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create your own date styles | |
# environment.rb | |
ActiveSupport::CoreExtenstions::Time::Conversions::DATE_FORMATS.merge!( | |
:simple => "%d %b %Y", | |
:last_login => "Last login: %m/%d/%y at %I:%M %p" | |
) | |
# used the same as above | |
>> now.to_s(:simple) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This isn’t anything new, or anything complex. But it’s handy, and for those who don’t know about it, well, you should know about it. | |
Have you ever been working on some code to build the next whatever-feature, and during that process, you realize some other bug that needs fixed, but isn’t necessarily a part of your whatever-feature? Here’s an alternative to handle that situation: | |
$ git stash | |
[fix the bug] | |
$ git commit -a -m "bug is now fixed" | |
$ git stash pop | |
git stash saves your changes and gives you a clean tree. Then you can do whatever it was you wanted to do (in this case, fix the bug) and commit it. git stash pop brings your changes back, and you can continue as if nothing ever happened. Sweet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout -b some-experiment | |
# do some work | |
git commit -m 'some feature' | |
# do some more work | |
git commit -m 'some other feature' | |
# experiment fails | |
git checkout master | |
# start working on new thing | |
git commit -m 'some mundane bugifx' | |
# realize I need some code from my experimental branch, but not the whole thing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERIONS | |
require File.joing(File.dirname(__FILE__), 'boot') | |
# This silences the Gem has no spec file warnings | |
Rails::VendorGemSourceIndex.silence_spec_warnings = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FreeAgent API Project Create | |
# Required attribues | |
# :contact_id | |
# :name | |
# :billing_basis # must be 1, 7, 7.5, or 8 | |
# :budget_units # must be Hours, Days, or Monetary | |
# :status # must be Active or Completed | |
def create_freeagent_project(current_user) | |
contact = Freeagent::Contact.find_by_name(company.companyname) | |
p = Freeagent::Project.create( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FreeAgent API Project Create | |
# Required attribues | |
# :contact_id | |
# :name | |
# :billing_basis # must be 1, 7, 7.5, or 8 | |
# :budget_units # must be Hours, Days, or Monetary | |
# :status # must be Active or Completed | |
def create_freeagent_project(current_user) | |
contact = Freeagent::Contact.find_by_name(company.companyname) | |
p = Freeagent::Project.create( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom"> | |
<title>Company Name Commits</title> | |
<link href="http://companynameltd.beanstalkapp.com/changesets/index.atom" rel="self"/> | |
<link href="http://companynameltd.beanstalkapp.com/" rel="alternate"/> | |
<id>http://companynameltd.beanstalkapp.com/</id> | |
<updated>2009-11-23T22:47:42Z</updated> | |
<author> | |
<name>John Doe</name> | |
</author> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in *.jpg; do newfile=`echo $file|sed 's/.jpg$/.JPG/'` ; mv -i "$file" "$newfile" ; done |
OlderNewer