Skip to content

Instantly share code, notes, and snippets.

Brandon Valentine bval

Block or report user

Report or block bval

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View backreference_failing_on_first_array_element.rb
site = "www.website.com"
months = ["www.website.com/awstats042009.www.website.com.txt", "www.website.com/awstats052009.www.website.com.txt"]
# below works better
months.map! { |m| m[/#{site}\/awstats([0-9]{6})\.#{site}\.txt/,1] }
puts months
View describe table
mysql> describe shipped_order;
+---------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| ship_to_address | varchar(255) | YES | | NULL | |
| total_weight | bigint(20) | YES | | NULL | |
| ups_tracking_number | bigint(20) | YES | | NULL | |
| real_shipping_costs | varchar(10) | YES | | NULL | |
| processing_date | date | YES | | NULL | |
View gist:768472
sfGuardUser:
sgu_admin:
username: admin
password: Client2009
is_super_admin: true
cwage:
username: cwage
password: changeme
first_name: Chris
last_name: Wage
View schema.yml
Employee:
columns:
id:
type: integer
primary: true
autoincrement: true
sf_guard_user_id:
type: integer
start_date:
type: date
View fixtures.yml
sfGuardUser:
sgu_admin:
username: admin
password: Client2009
is_super_admin: true
cwage:
username: cwage
password: changeme
first_name: Chris
last_name: Wage
View gist:788241
<?php
/**
* Department form.
*
* @package skeleton
* @subpackage form
* @author Your name here
* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
View gist:1045916
class ApplicationController < ActionController::Base
protect_from_forgery
private
def current_user_session
@current_user_session ||= UserSession.find
end
def current_user
current_user_session && current_user_session.user
View gist:1089963
it "fails" do
fail "hey buddy, you should probably rename this file and start specing for real"
end
View gist:1761786
[ ["-71", "-49"], ["-47", "-37"], ["-73"] ] =returns=> [ ["-71", "-47", "-73"] ["-71", "-37", "-73"] ["-49", "-47", "-73"] ["-49", "-37", "-73"] ]
or
[
["-71", "-49"],
["-47", "-37"],
["-73"]
]
returns
[
@bval
bval / gist:2239660
Created Mar 29, 2012
HTML Salutations
View gist:2239660
<select name="salutation" size="1">
<option value="">
-- please make a selection --
</option>
<option value="Admiral">
Admiral
</option>
<option value="Ambass. &amp; Mrs.">
You can’t perform that action at this time.