$ rails g model User
belongs_to
has_one
# update installed packages | |
sudo apt-get update | |
sudo apt-get upgrade | |
# ssh server | |
sudo apt-get install openssh-server -y | |
# install curl | |
sudo apt-get install curl -y |
# loop through nodes:story data | |
json_data['nodes']['story'].each do |i, story| | |
################################################## | |
# modify html per google prettify | |
# scan for <code> tags | |
matches = story['body'].scan(/(<code>)(.*?)(<\/code>)/im) | |
matches.each do |match| | |
new_string = '<pre class="prettyprint"><code class="prettyprint">' + match[1].gsub(/<\?php/, '<?php') + '</code></pre>' |
1.9.2-p290 :002 > u = Upload.new | |
=> #<Upload id: nil, post_id: nil, created_at: nil, updated_at: nil, upload_file_name: nil, upload_content_type: nil, upload_file_size: nil, upload_updated_at: nil> | |
1.9.2-p290 :004 > u.upload = File.open('/Users/Eric/Desktop/estimation grid.png') | |
=> #<File:/Users/Eric/Desktop/estimation grid.png> | |
1.9.2-p290 :005 > u.save! | |
(0.1ms) begin transaction | |
SQL (17.4ms) INSERT INTO "uploads" ("created_at", "post_id", "updated_at", "upload_content_type", "upload_file_name", "upload_file_size", "upload_updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Fri, 16 Mar 2012 16:13:46 UTC +00:00], ["post_id", nil], ["updated_at", Fri, 16 Mar 2012 16:13:46 UTC +00:00], ["upload_content_type", "image/png"], ["upload_file_name", "estimation_grid.png"], ["upload_file_size", 53079], ["upload_updated_at", Fri, 16 Mar 2012 16:13:43 UTC +00:00]] | |
(23.8ms) commit transaction |
# I created a Post controller to accept a parameter for tag name. | |
# The problem is, the tag "Drupal 6.x", or anything with a period was triggering :format | |
get 'posts/tag/:tag' => 'posts#tag', :format => false, :constraints => {:tag => /.*/} |
# Usage: | |
# tree = RandomTreeToken.new | |
# puts tree.generate | |
class RandomTreeToken | |
def initialize | |
require 'net/http' | |
url = 'http://treesofnorthamerica.net/' | |
body = Net::HTTP.get_response(URI.parse(url)).body |
#!/usr/bin/env ruby | |
require 'selenium-webdriver' | |
require 'uri' | |
website_url = ARGV[0] | |
if website_url.empty? | |
puts "Website Argument Required.\n" | |
exit() | |
end |
[user] | |
name = Eric London | |
email = [email protected] | |
[core] | |
excludesfile = /Users/Eric/.gitignore | |
[alias] | |
lg = log --graph --pretty=format:'%C(red)%h%Creset%C(yellow)%d%Creset %C(bold blue)%an%Creset %C(green)%cr%Creset %s' --abbrev-commit --date=relative --all | |
lg2 = log --graph --pretty=format:'%C(red)%h%Creset%C(yellow)%d%Creset %C(bold blue)%an%Creset %C(green)%cr%Creset %s' --abbrev-commit --date=relative | |
[color] | |
ui = auto |
require 'nokogiri' | |
require 'open-uri' | |
require 'pp' | |
url = "http://www.bedbathandbeyond.com/product.asp?sku=40354439&" | |
doc = Nokogiri::HTML(open(url)) | |
data = {} |
framework 'AppKit' | |
class Download | |
attr_reader :response, :responseBody | |
def start(request) | |
puts "START!" | |
NSURLConnection.connectionWithRequest(request, delegate:self) | |
end |