Skip to content

Instantly share code, notes, and snippets.

View ryanjm's full-sized avatar

Ryan Mathews ryanjm

View GitHub Profile
@ryanjm
ryanjm / OQCAppDelegate.m
Created November 2, 2011 01:13
Issue with CGContext and iOS5
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[self.navigationController.navigationBar setNeedsDisplay];
...
}
@ryanjm
ryanjm / log
Created February 15, 2012 15:48
Devise NoMethodError
Started GET "/sign_in" for 127.0.0.1 at 2012-02-15 09:39:58 -0600
NoMethodError (undefined method `scoped_path' for nil:NilClass):
devise (2.0.1) app/controllers/devise_controller.rb:164:in `_prefixes'
actionpack (3.2.0) lib/abstract_controller/view_paths.rb:45:in `lookup_context'
actionpack (3.2.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (3.2.0) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.0) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.0) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:66:in `call'
@ryanjm
ryanjm / gist:2320468
Created April 6, 2012 14:41
Special variables for dates
# == Schema Information
#
# Table name: showings
#
# id :integer not null, primary key
# start_time :datetime
# end_time :datetime
class Showing < ActiveRecord::Base
attr_accessor :showing_date, :start_date, :end_date
@ryanjm
ryanjm / post-commit
Created May 7, 2012 16:23 — forked from c00kiemon5ter/post-commit
a hook to deploy static generated sites
#!/usr/bin/env bash
# executables prefix
_prefix="/usr/local/bin"
# git executable
_git="$_prefix/git"
# site generation executable
_generate="$_prefix/jekyll"
# options for the generator
@ryanjm
ryanjm / gist:2999736
Created June 26, 2012 22:28
A little lesson in ruby methods

Methods in ruby have a special feature if the last attribute is a hash

def dashed_keys(h1, h2)
  "h1(#{ h1.keys.join("-") }) h2(#{ h2.keys.join("-") })"
end

> dashed_keys({:a => 1, :b => 2}, {:m => 13, :n => 14})
=> "h1(a-b) h2(m-n)"
# opens file
f = File.new('small.csv','r')
# grab all the lines (array)
lines = f.readlines
# header will be first line, take it out and strip white space
headers = lines.shift.strip
keys = headers.split(',')
# value to hold presidents
presidents = []
# loop over remaining lines
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Index</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style type="text/css" media="all">
.container { width: 960px; margin: 0 auto; }
.item { height: 30px; }
</style>
@ryanjm
ryanjm / gist:4279976
Created December 13, 2012 21:16
For lightening talk
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Evented Programming</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>KML Test</title>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" charset="utf-8">
// this is a function to be called when the page has loaded. In Rails we'll be using jQuery and this will be a little different

Test

  • Click the Setup tab: It is located in the menu bar and will only be accessible to Administrators.
  • Click the Setup tab: It is located in the menu bar and will only be accessible to Administrators.