Skip to content

Instantly share code, notes, and snippets.

View joevandyk's full-sized avatar

Joe Van Dyk joevandyk

View GitHub Profile
require 'rubygems'
require 'httparty'
module Shack
class Comment
attr_reader :username, :body, :preview, :comment_id
def initialize comment
@username = comment["author"]
@preview = comment["preview"].gsub("\n", ' ')
sidekick:groupy jordanisip$ git pull --rebase
remote: Counting objects: 175, done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 133 (delta 58), reused 113 (delta 42)
Receiving objects: 100% (133/133), 22.99 KiB, done.
Resolving deltas: 100% (58/58), completed with 9 local objects.
From git@github.com:joevandyk/groupy
d01dfa2..8c0bfd7 master -> origin/master
First, rewinding head to replay your work on top of it...
HEAD is now at 8c0bfd7... Subdomains should work now. (be sure to add them to /etc/localhost when developing!)
class FeedController < ApplicationController
after_filter :remember_cache
before_filter :check_for_cache
def blog
@blogs = Blog.last_few_blogs 10
response.headers["Content-Type" ] = "text/xml;"
render :layout => false
end
def initialize hsh={}
hsh.each do |key, value|
instance_variable_set "@#{key}", value
end
end
=> #<Bj::Table::Job bj_job_id: 7581, command: "cat /etc/passwd", state: "finished", priority: 0, tag: "", is_restartable: 1, submitter: "ey03-s00372", runner: "ey03-s00372", pid: 5371, submitted_at: "2008-08-22 17:08:26", started_at: "2008-08-22 17:08:51", finished_at: "2008-08-22 17:08:51", env: nil, stdin: nil, stdout: "root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:...", stderr: "", exit_status: 0>
@joevandyk
joevandyk / gist:6933
Created August 23, 2008 17:43
How to create ActiveRecord classes on the fly
def create_activerecord_class table_name
Class.new(ActiveRecord::Base) do
set_table_name table_name
end
end
# I already have a users db table
# So in the console...
>> AnotherUser = create_activerecord_class(:users)
=> AnotherUser(id: integer, first_name: string, last_name: string, ...... )
# Install WhiteList plugin from http://svn.techno-weenie.net/projects/plugins/white_list/
class ApplicationController < ActionController::Base
before_filter :strip_naughty_stuff_from_forms
private
def strip_naughty_stuff_from_forms
strip_naughty_stuff_from_hash(params)
end
# Install WhiteList plugin from http://svn.techno-weenie.net/projects/plugins/white_list/
class ApplicationController < ActionController::Base
before_filter :strip_naughty_stuff_from_forms
private
def strip_naughty_stuff_from_forms
strip_naughty_stuff_from_hash(params)
end
@joevandyk
joevandyk / Joe Van Dyk's Resume
Created September 9, 2008 04:42
Resume of Joe Van Dyk
JOE VAN DYK
CONTACT INFORMATION
=============================
joe@fixieconsulting.com
http://fixieconsulting.com
http://github.com/joevandyk
http://www.workingwithrails.com/recommendation/for/person/7469-joe-van-dyk
-----Original Message-----
From: Mail Delivery System [mailto:Mailer-Daemon@smtp.ey03.engineyard.com]
Sent: Tuesday, September 09, 2008 11:23 AM
To: Eric Schinfeld
Subject: Mail delivery failed: returning message to sender
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed: