Public Gists by wmoxam

Gravatar
Tue Oct 27 17:12:52 -0700 2009
1
2
3
#!/usr/local/bin/ruby
 
def fib(n)
Gravatar
Wed Sep 30 13:14:57 -0700 2009
1
2
3
config/initializers/custom_requires.rb
 
 
Gravatar
Wed Sep 23 08:07:17 -0700 2009
1
2
3
class Test
  def self.a=(b)
    return 'hello'
Gravatar
Mon Sep 14 12:19:42 -0700 2009
1
2
3
def auto_link_html(html)
    substitutions = {}
    stripped_html = html.to_s.dup
Gravatar
Sat Sep 12 11:48:06 -0700 2009
1
2
3
"I think [Ruby on] Rails has tapered out a little bit lately. Maybe the new version that they're coming out with –
the one that's actually fast (laughs) – maybe that will be interesting. But there are performance issues with the
scaffolding and stuff, and they recognise that, which is why the new build will be better. But I've never been a huge
Gravatar
Thu Sep 10 07:28:29 -0700 2009
1
2
3
case
when params[:a]
  # do stuff
Gravatar
Thu Aug 20 17:55:26 -0700 2009
1
2
3
// http://web.archive.org/web/20010518151731/deathstar.eng.utah.edu/~kroford/
 
var manTrance = 0;
Gravatar
Mon Aug 17 11:51:30 -0700 2009
1
2
3
14:49 < php-bot> The purpose of ##php is to assist those that have EXHAUSTED
                 their resources (manual, google, appropriate irc channels,
                 etc) in developing their OWN php code. We are not your
Gravatar
Fri Aug 07 13:54:35 -0700 2009
1
2
3
>> a = (32.675 * 100.00)
=> 3267.5
>> a.round
Gravatar
Tue Jul 28 07:33:01 -0700 2009
1
2
3
009:0> FasterCSV.parse("1,2,\"d,c\",4")
=> [["1", "2", "d,c", "4"]]
irb(main):010:0> FasterCSV.parse("1,2, \"d,c\",4")
Gravatar
Mon Jul 20 14:00:09 -0700 2009
1
2
3
# This is a straight up has_many :through 'tagging' model. No plugins.
 
>> t.update_attributes! :taggings_count => t.taggings.count
Gravatar
Fri Jul 17 10:07:50 -0700 2009
1
2
3
class Quiz < ActiveRecord::Base
  has_many :questions, :dependent => :destroy
end
Gravatar
Fri Jun 12 08:34:31 -0700 2009
1
2
3
#!/bin/sh
 
export RUBY_HEAP_MIN_SLOTS=500000
Gravatar
Thu Jun 11 12:13:59 -0700 2009
1
2
3
module AsyncObserver::Extensions
  def async_execute(selector, *args)
    if RAILS_ENV == 'test' # this is due to async_obeserver's poor test integration :(
Gravatar
Fri May 08 09:05:52 -0700 2009
1
2
3
The sour merbist
 
11:36 smoofles is always fascinated how dhh managed to completely kill merb in such a short time
Gravatar
Wed Apr 29 13:57:21 -0700 2009
1
2
3
# version 2.0 of http://ozmm.org/posts/easy_rails_asset_ids_with_git.html
 
repo = Grit::Repo.new('/path/to/your/app/shared/cached-copy')
Gravatar
Mon Apr 27 13:08:24 -0700 2009
1
2
3
Giles on Rails:
 
I've been coding Ruby near-exclusively for years now. On the one hand, I want to tell you we're not all like that. On the other hand, RailsConf is just weeks away, and I'm dreading it so much that words fail me, because even though we're not all like that, an awful lot of us are exactly like that. I'm not at all surprised to find idiots defending the presentation, and that shameful, ridiculous unpology the presenter delivered is par for the course.
Gravatar
Fri Apr 17 07:47:55 -0700 2009
1
2
3
#!eruby
<%
require "cgi"
Gravatar
Tue Apr 14 08:15:07 -0700 2009
1
2
3
wget --save-cookies=cookies.txt --keep-session-cookies -O /dev/null --post-data="username=foo&password=bar" http://mysite.com/sign_in
 
# get the cookie out of cookies.txt
Gravatar
Tue Apr 07 12:17:43 -0700 2009
1
2
3
module ActionMailer
  class Base
    # I want layouts to apply to email parts seperately!