Public Gists by NewMonarch

Gravatar
Sat Oct 31 17:23:01 -0700 2009
1
2
3
  def index
    @assets = current_account.assets.paginate :page => params[:page], :per_page => 10
  end
Gravatar
Sat Oct 10 00:01:25 -0700 2009
1
2
3
require 'models/developer'
require 'models/project'
 
Gravatar
Mon Sep 14 21:51:09 -0700 2009
1
2
3
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
Gravatar
Fri Sep 04 14:53:49 -0700 2009
1
2
3
<?php
 
//exploit search
Gravatar
Sun Aug 30 13:35:01 -0700 2009
1
2
3
# needed to get spork/rspec running under snow leopard
# edit line 12 of rspec-1.2.8/lib/spec/runner/drb_command_line.rb
 
Gravatar
Sat Aug 29 09:38:43 -0700 2009
1
2
3
      === Epic Snow Leopard Upgrayyyyd Guide ===
 
Son, you’re now living in the land of 64-bit systems.
Gravatar
Fri Aug 21 12:49:29 -0700 2009
1
2
3
require 'unicode'
class String
  def to_permalink
Gravatar
Fri Jul 03 12:08:32 -0700 2009
1
2
3
s3_config = YAML.load_file(RAILS_ROOT + "/config/amazon_s3.yml")
s3_config = s3_config['staging'].to_options
 
Gravatar
Thu Jun 25 13:27:13 -0700 2009
1
2
3
> Product.best_sellers
'SELECT `products`.*, COUNT(*) AS total FROM `products` INNER JOIN order_items ON order_items.product_id = products.id INNER JOIN orders ON orders.id=order_items.order_id WHERE ((orders.payment_state=3) GROUP BY products.id ORDER BY total DESC'
# Yay!
Gravatar
Tue Apr 21 07:01:07 -0700 2009
1
2
3
class AddSecurityStringToOrder < ActiveRecord::Migration
  def self.up
    add_column :orders, :security_string, :string
Gravatar
Tue Feb 17 12:45:35 -0800 2009
1
undefined
Gravatar
Fri Jan 16 09:48:21 -0800 2009
1
2
3
## Colors Git and shows branch
 
function parse_git_branch {
gist: 44415 Improved! A slight alterati...
Gravatar
Wed Jan 07 12:45:48 -0800 2009
1
2
3
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
Gravatar
Wed Nov 19 20:14:31 -0800 2008
1
2
3
$ gem install bleak_house
Building native extensions. This could take a while...
ERROR: Error installing bleak_house:
Gravatar
Wed Nov 19 13:17:43 -0800 2008
1
2
3
str = "So don't return this (but do return this)"
start = str.index("(")+1
stop = str.rindex(")")-1
Gravatar
Mon Sep 08 16:18:28 -0700 2008
1
2
3
## Tests
 def test_grouped_options_for_select_with_array
      assert_dom_equal(
Gravatar
Thu Sep 04 19:17:49 -0700 2008
1
2
3
def optgroups_with_options(groups, options, selected = nil, prompt = nil)
      return "<option>Error: Sizes don't match.</option>" if groups.size != options.size
      str = String.new
Gravatar
Thu Sep 04 19:03:02 -0700 2008
1
2
3
  <div class="product_row add_new_product" id="new_design">
    <a href="#" onclick="try {
new Insertion.Before(&quot;new_design&quot;, &quot;\n&lt;div class=\&quot;product_row add_new_product\&quot; id=\&quot;new_product\&quot;&gt;\n &lt;a href=\&quot;#\&quot; onclick=\&quot;try {\nnew Insertion.Before(&quot;new_product&quot;, &quot;&lt;p&gt;This works.&lt;/p&gt;&quot;);\n} catch (e) { alert('RJS error:\\n\\n' + e.toString()); alert('new Insertion.Before(\\&quot;new_product\\&quot;, \\&quot;&lt;p&gt;This works.&lt;/p&gt;\\&quot;);'); throw e }; return false;\&quot;&gt;Add another product&lt;/a&gt;&lt;/div&gt;&quot;);
Gravatar
Thu Sep 04 17:17:17 -0700 2008
1
2
3
 
   def american_apparel_2001_colors
      ["Aqua","Army","Ash Grey (no xs)","Ash White Stripe (no xs)","Asphalt","Baby Blue","Black","Brown","Cranberry",
Gravatar
Wed Sep 03 14:45:02 -0700 2008
1
2
3
module PrintingHelper
   
   def other_position