Skip to content

Instantly share code, notes, and snippets.

View alterisian's full-sized avatar

Ian Moss alterisian

View GitHub Profile
@urbed
urbed / Questions.md
Last active March 9, 2017 12:15
Any comments please?
  1. Im reasonably happy to live with the method in the controller, unless you say otherwise.

  2. I've looked in vain for an authorative answer for the 'neater syntax' part of this: If I wanted a categories controller with simpy a param[:id] for both URLs below, what would I write in routes.rb please? I reckon this involves writing two GET directives in a particular order in routes.rb, but is there a neater syntax?

  GET /categories/:id/show_full    categories#show_full
  GET	 /categories/:id             categories#show
  1. So I believe I'm doing three (N+1) queries to display that page. If I was concerned about performance (one day I will be) what lines of attack do I have to reduce a performance hit?

Thanks!

@alterisian
alterisian / fixnum_ordinalize.rb
Created November 27, 2012 13:07
Adds ordinalize i.e. th,st,rd to a number for use in date string outputs
class Fixnum
def ordinalize
if (11..13).include?(self % 100)
"#{self}th"
else
case self % 10
when 1; "#{self}st"
when 2; "#{self}nd"
when 3; "#{self}rd"
else "#{self}th"
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@eightbitraptor
eightbitraptor / go go TDD
Created October 19, 2011 10:40
My 2 favourite config lines ever
autocmd BufRead,BufNewFile *_spec.rb
\ map ;t :w\|:!rspec --no-color %<cr>
autocmd BufRead,BufNewFile *_test.rb
\ map ;t :w\|:!ruby -Ilib %<cr>
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@jeffkreeftmeijer
jeffkreeftmeijer / bassie.png
Created April 11, 2011 12:01
Colored image blob detection
bassie.png
@alterisian
alterisian / grailsCheatSheet
Created November 11, 2010 11:55
Grails Command Line Cheat Sheet
grails create-app Creates a Grails application for the given name
grails create-domain-class Creates a new domain class
grails generate-all Generates a CRUD interface (controller + views) for a domain class
grails install-plugin Installs a plug-in for the given URL or name and version
grails create-controller Creates a new controller
grails interactive Starts Grails CLI (script runner) in interactive mode.
Keeps the JVM running between grails commands for faster script execution.
grails console Load the Grails interactive Swing console
grails run-app grails [environment]* run-app - Runs a Grails application