Skip to content

Instantly share code, notes, and snippets.

View lmarburger's full-sized avatar
🥖
Temporally nondeterministic

Larry Marburger lmarburger

🥖
Temporally nondeterministic
View GitHub Profile
class ActionView::TestCase
class TestController < ActionController::Base
attr_accessor :params
# Save the current initialize method to call in the new initialize method below.
alias_method :base_initialize, :initialize
def initialize
base_initialize
'/^(?:(?:(?<!^):)?[0-9A-Fa-f]{2}){6}$/'
named_scope :by_keyword do |keyword|
keywords = keyword.downcase.split
query = "lower(profiles.job_title) like ? OR lower(resumes.body) like ? OR lower(career_level) like ? OR profiles.work_experience like ? OR profiles.degree_level like ? OR profiles.military_service like ? OR profiles.military_security like ? OR firstname like ? OR lastname like ? OR locations.city like ? OR locations.state like ? OR locations.zipcode like ? OR summary like ?"
parameters = 13
conditions = [ ([ query ] * keywords.size).join(" OR ") ]
keywords.inject(conditions) do |conditions, keyword|
conditions += [ keyword ] * parameters
end
$ env | grep PATH
PATH=/usr/local/ruby-enterprise/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
$ sudo env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
#signup
+column(12)
form
label
+column(4)
input
+column(4, true)
&[type=submit]
+column(4, true)
#friends = Array.new
#current_user.connections.each do |c|
#friends.push([c.friend.full_name, c.user_id])
friends = current_user.connections.map do |c|
[ c.friend.full_name, c.user_id ]
end
friends = friends.sort do |a, b|
a[0] <=> b[0]
@lmarburger
lmarburger / flatten.rb
Created December 16, 2009 02:50 — forked from avdi/flatten.rb
# Single-level flatten
arr = [ [1], [2,3], [4, [5]] ]
# Too flat!
arr.flatten # => [1, 2, 3, 4, 5]
# Just right!
arr.inject([]){|a,e| a.concat(e)} # => [1, 2, 3, 4, [5]]
// Before vim-javascript
method(arg1, arg2,
arg3);
// After vim-javascript
method(arg1, arg2,
arg3);
// After (Not sure I like this)
foldingStartMarker = '/\*(\*|\s+\w)(?!\*)|\{\s*($|/\*(?!.*?\*/.*\S))';
foldingStopMarker = '(?<!\*)\*\*/|/\*\s+-+\s+\*/|^\s*\}';
Update these expressions so they also recongize:
foldingStartMarker:
/* section: something variable
---------------------------------------------- */
exec_last_feature_or_test(){
history|sort -r|sed -s 's/^ [0-9]* //'|while read i;do if [[ "$i" =~ ^ruby || "$i" =~ ^cucumber ]];then echo $i|sh;exit;fi;done
}