Skip to content

Instantly share code, notes, and snippets.

View robyurkowski's full-sized avatar

Rob Yurkowski robyurkowski

View GitHub Profile
@robyurkowski
robyurkowski / phonegap_install.log
Created August 2, 2011 17:48
Phonegap install issues
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: @(#)PROGRAM:Install PROJECT:Install-684
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: @(#)PROGRAM:Installer PROJECT:Installer-530
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Hardware: iMac11,2 @ 3.06 GHz (x 4), 4096 MB RAM
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Running OS Build: Mac OS X 10.7 (11A511)
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: TMPDIR=/var/folders/6q/_3ryf5yj0q917628qn45xmt00000gn/T/
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: SHELL=/bin/bash
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: HOME=/Users/rob
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: USER=rob
Aug 2 11:47:41 Rob-Yurkowskis-iMac Installer[4002]: Env: LOGNAME=rob
@robyurkowski
robyurkowski / events_controller.rb
Created August 1, 2011 07:14
content_for :body_content_side does not show up...
class EventsController < ApplicationController
before_filter :find_all_events
before_filter :find_page
def index
# you can use meta fields from your model instead (e.g. browser_title)
# by swapping @page for @event in the line below:
present(@page)
end
@robyurkowski
robyurkowski / question.markdown
Created April 21, 2011 05:59
Question for Regina Palliser Candidates

Most of the time, when we talk about the economy, we hear that we need to 'rein in spending', that we need to trim our expenses. But it's relatively rare that we hear anything about growing our economy, except as part of the 'cut taxes' refrain. Do you think we ought to be more concerned with growing, rather than pruning? If yes, what steps as our MP would you take to help our economy flourish? Finally, how would you guarantee that the economic growth would go toward helping low- and middle-class families, rather than wallpapering executives' houses?

I disagree strongly with the notion that emotion and tone must be left up to the imagination in written communication. It's often repeated, I think, because we don't have the full range of subtext provided by the body when communicating in person, but I'd argue that there is a whole host of metadata that accompanies the written statement, anyway. Semiological constructions have evolved over time to provide these visual cues—perhaps not in the same way, but certainly in a way that is respectible and replete with its own intricacies of meaning.
Credo: I believe that it is entirely possible to communicate without ambiguity in writing. Most importantly, I believe it is possible to do so in a concise manner. Correspondingly, I tend to get upset when I see prohibitions of parts of written speech. There's a difference between guarding against overuse and the often deontological imperative implied with such prohibitions. The occasional adverb adds spice, and the occasional exclamation point will clarify a sentence j
@robyurkowski
robyurkowski / robox.rb
Created December 2, 2010 15:50
Lines for checking if symlinked, setting appropriate load path, and `chdir`ing for file reads
#!/usr/bin/env ruby
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
$LOAD_PATH.unshift File.expand_path(File.dirname(THIS_FILE))
Dir.chdir(File.expand_path(File.dirname(THIS_FILE)))
@robyurkowski
robyurkowski / posts_controller.rb
Created November 9, 2010 06:03
Weird routing error.
class PostsController < ApplicationController
def results
params[:search] = params[:search].blank? ? '%' : "%#{params[:search]}%"
@posts = Post.where("body LIKE ? OR title LIKE ?", params[:search], params[:search]).published(true).paginate(:per_page => 5, :page => params[:page])
render :action => :index
end
end
So I have a model named Droplet. A droplet is essentially a catch-all status update. It looks like this:
Droplet
-------
- id
- title:varchar(255)
- body:varchar(255)
- user_id:int(11)
class UserSessionsController < ApplicationController
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Logged in successfully."
redirect_to_target_or_default(root_url)
## Cucumber Scenario
@wip
Scenario: Login with correct details
Given a user named "brent" exists
When I go to login
And I fill in "Username" with "brent"
And I fill in "Password" with "screech"
And I press "Log In"
And show me the page
desc "Fetch product prices"
task :updatepayouts => :environment do
require 'mechanize'
agent = WWW::Mechanize.new
Offer.find_all_by_payout(nil).each do |offer|
escaped_offer_name = CGI.escape("\"#{offer.name}\"")
agent.get("http://odigger.com/?&q=#{escaped_offer_name}&network_id=")
agent.page.search(".payout").each do |offer2|
offer.update_attribute(:payout, offer2.text.strip)
end