Skip to content

Instantly share code, notes, and snippets.

View qrush's full-sized avatar
🕸️
Making internets

Nick Quaranto qrush

🕸️
Making internets
View GitHub Profile
class AddPriceToProduct < ActiveRecord::Migration
def self.up
options = {:precision => 8, :scale => 2, :default => 0}
add_column :products, :decimal, options
add_column :price, :decimal, options
end
def self.down
remove_column :products, :price
def self.find_by_permalink(link)
cat = nil
if link.to_i == 0
cat = Category.find_by_name(link.gsub(/ /, "-").titlecase)
else
cat = Category.find(link)
end
irb(main):003:0> a = [['a', 1], ['b', 2], ['c', 3]]
=> [["a", 1], ["b", 2], ["c", 3]]
irb(main):004:0> a.flatten
=> ["a", 1, "b", 2, "c", 3]
irb(main):005:0> b = {}
=> {}
irb(main):006:0> a.each{|p| b[p[0]] = p[1] }
=> [["a", 1], ["b", 2], ["c", 3]]
irb(main):007:0> b
=> {"a"=>1, "b"=>2, "c"=>3}
private struct BoxInstance
{
public Vector3 position;
public Vector3 dimensions;
public Vector3 rotation;
public Vector4 color;
public bool inUse;
//*****************************************************************
#############################################################
# Application
#############################################################
set :application, "" #your app's name here
set :server_ip, "" #your server's ip here
set :deploy_to, "/home/rails/#{application}" #the path to your rails app here
#############################################################
# Servers
# this is in application.rb. Yes, I'm lazy.
# holy mess, batman!
uses_tiny_mce(:options => { :theme => 'advanced',
:mode => "textareas",
:convert_urls => false,
:remove_script_host => true,
:theme_advanced_toolbar_location => "top",
:theme_advanced_toolbar_align => "left",
:theme_advanced_resizing => true,
qrush@q-laptop ~/Sources> git clone git://github.com/why/shoes.git
Initialized empty Git repository in /home/qrush/Sources/shoes/.git/
remote: Counting objects: 5925, done.
remote: Compressing objects: 100% (1774/1774remote: ), done.
remote: Total 5925 (delta 4079), reused 5925 (delta 4079)
Receiving objects: 100% (5925/5925), 1.96 MiB | 225 KiB/s, done.
Resolving deltas: 100% (4079/4079), done.
qrush@q-laptop ~/Sources> cd shoes/
qrush@q-laptop ~/S/shoes> rake
(in /home/qrush/Sources/shoes)
Loading development environment (Rails 2.1.1)
Missing the Rails 2.1.1 gem. Please `gem install -v=2.1.1 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
qrush@q-imac ~/D/r/medqd> gem list | grep rails
gemsonrails (0.7.2)
rails (2.1.1)
@qrush
qrush / gist:9810
Created September 10, 2008 02:22
Mike,
Hello, I am from approximately two months in the future. On 10/22 at approx 2:34am CET a tachyon
field failure in the main resonating ring of the LHC causes a "temporal blowback". Shortly
thereafter, the resulting destruction of the strong nuclear force causes the world to vaporize in
seconds, while a few of us near the experiment are thrown into a temporal causality loop. While
the predestination event (or as we have come to call it "The Big Rewind") hasn't occurred yet to
you, for us it is about three years in our past. I came across your site looking to see if there
were any other scientists that may have theorized this phenomenon who may be of assistance in
preventing it. This brings me to my point, I have repeatedly checked your site for the past five
Sep 11 01:49:19 mydomain postfix/smtpd[11154]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 550 5.1.1 <marc@mydomain.com>: Recipient address rejec
ted: User unknown in local recipient table; from=<webmaster@mydomain.com> to=<marc@mydomain.com> proto=ESMTP helo=<localhost.localdomain>
S