Skip to content

Instantly share code, notes, and snippets.

View dnordstrom's full-sized avatar

Daniel Nordstrom dnordstrom

View GitHub Profile
@dnordstrom
dnordstrom / LOLfile
Created December 9, 2011 20:09
LOL?!?
daniel-win:hyde Daniel$ rvmsudo hyde
Password:
[2011-12-09 20:34:41] INFO WEBrick 1.3.1
[2011-12-09 20:34:41] INFO ruby 1.9.3 (2011-10-30) [x86_64-darwin11.2.0]
[2011-12-09 20:34:41] INFO WEBrick::HTTPServer#start: pid=2845 port=80
localhost - - [09/Dec/2011:20:34:52 CET] "GET / HTTP/1.1" 200 12
- -> /
localhost - - [09/Dec/2011:20:34:53 CET] "GET /favicon.ico HTTP/1.1" 200 12
- -> /favicon.ico
localhost - - [09/Dec/2011:20:48:26 CET] "GET /scrape?info_hash=%a60N%1bu%1f%5et%b7%bd%ee%0f%5e%da%97%80%2a%f7M%1f&info_hash=%2b%f9%e5%40%3a%b2%13%1c%84%aa%db%04%ca%d0%cdv%fb%af%a4%d9&info_hash=_%b9%deM%0c%c0%0fy%c9%ee%01~%15%adJw%0e%9f%0e%94&info_hash=%d0%ebn4%f1%2aML%89%8c%9b%ddy%88%86%e4%09%d9%8d%96&info_hash=%80JL%9e%ed%f9M%1cf%87%3f%f7%c1%96%408%e2l%be%c8&info_hash=2%01%18%8b%3eeo%5c%ece%29~%80y%19%28%0b%e6%99c&info_hash=%94%1d%b3%25w%d3K%ef%d2%5e%f3%b1%fc%9e%05%94%a6%e0%ff%e0&info_hash=I-My%c0b%d8%3ev%a7%ed%87%a3%cb%a9%40YH%14%ea&info_hash=%97zvCX1%bf%3e%9f%11%1c%c7%1em%a0e.%85O%0d&info_hash=%b3%40I%ab%13p%84%
@dnordstrom
dnordstrom / markup_helper_spec.rb
Created December 5, 2011 19:29
String testing
require_relative "../../lib/coffeeshop"
require_relative "../spec_helper"
include CoffeeShop
include SpecHelper
include MarkupHelper
describe MarkupHelper do
before :all do
@base = CoffeeShop::Application.base
@dnordstrom
dnordstrom / gist:1396063
Created November 26, 2011 18:10
Re-gisted!
class DevicesController < ApplicationController
before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
def update_registration_id
@device = Device.find_by_device_id(params[:device_id])
@device.registration_id = params[:registration_id]
@device.save
end
sdfsdsfdfsdsf
@dnordstrom
dnordstrom / gist:1201314
Created September 7, 2011 18:25
Ugly code
def in_range?(day)
return true if start_date.nil? || end_date.nil?
# Overlaps onto new year, e.g. winter season
if start_date.month > end_date.month
if day.to_date.month >= start_date.month && day.to_date.month <= 12 # Checking date still in current year
if day.to_date.month >= start_date.month
if day.to_date.month == start_date.month
return true if day.to_date.day >= start_date.day
return false
end