Skip to content

Instantly share code, notes, and snippets.

diff --git a/app/controllers/parents_controller.rb b/app/controllers/parents_controller.rb
index 4f6831f..ce6c226 100644
--- a/app/controllers/parents_controller.rb
+++ b/app/controllers/parents_controller.rb
@@ -25,6 +25,7 @@ class ParentsController < ApplicationController
# GET /parents/new.json
def new
@parent = Parent.new
+ @parent.children.build
diff --git a/app/controllers/parents_controller.rb b/app/controllers/parents_controller.rb
index 4f6831f..ce6c226 100644
--- a/app/controllers/parents_controller.rb
+++ b/app/controllers/parents_controller.rb
@@ -25,6 +25,7 @@ class ParentsController < ApplicationController
# GET /parents/new.json
def new
@parent = Parent.new
+ @parent.children.build
@danvine
danvine / mercenary.sh
Created March 26, 2012 13:16
rails mercenary
#!/usr/bin/env bash
ps aux | fgrep 'ruby script/rails s -d' | awk '{print $2}' | xargs kill -9
@danvine
danvine / rtail.sh
Created March 26, 2012 13:13
rails tail
#!/usr/bin/env bash
# filter out the noisy asset pipeline
tail -f ./log/development.log | egrep -v "(^$|GET|Served)"
@danvine
danvine / hack.sh
Created March 31, 2012 19:02 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@danvine
danvine / gist:3019133
Created June 29, 2012 16:48
Mobile Redirect using htaccess
# via http://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess
RewriteEngine on
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.website.com]
# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
@danvine
danvine / proxy.php
Created July 11, 2012 02:23
Simple php cacheing proxy for url2png.com
<?php
function url2png_v6($url, $args) {
# Get your apikey from http://url2png.com/plans
$URL2PNG_APIKEY = "PXXXX";
$URL2PNG_SECRET = "SXXXX";
# urlencode request target
<?xml version="1.0" encoding="UTF-8"?>
<Hello>World</Hello>
@danvine
danvine / call_me_baby.rb
Created August 9, 2012 12:25
Cron job to call and connect you to your daily scrum via Twilio
require 'twilio-ruby'
require 'yaml'
account_sid = 'AC--------------------------------'
auth_token = '--------------------------------'
config = {
:from => '+15555555555', # your twilio verified phone number
:to => '+15558675309', # your phone number
:url => 'http://yourdomain.com/scrum/?call=18886191583&pass=555555555' # where the Twiml XML file below is hosted
@danvine
danvine / capybara cheat sheet
Created August 14, 2012 11:36 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')