I hereby claim:
- I am freshtonic on github.
- I am jamessadler (https://keybase.io/jamessadler) on keybase.
- I have a public key whose fingerprint is F8E7 54C6 DEF1 9E63 1532 B955 81DD 8C74 7C2A 25B7
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
# Reads your JS on STDIN, minified JS is OK as angular methods names should be preserved. | |
# The reason this exists is because I was getting an erroroneous error message about missing | |
# module 'ngLocale', but googling that indicated that it really meant that one of my dependencies | |
# was unresolved. A change to the JS concatenation had caused this error. | |
# In order to resolve the error I wrote a script to parse the old minified and new minified JS to dump | |
# declared services to STDOUT. I could then see what was missing. |
extern crate regex; | |
extern crate core; | |
use std::str; | |
use std::slice::SliceConcatExt; | |
use self::core::str::StrExt; | |
use self::regex::Regex; | |
use std::num::ToPrimitive; |
paperclip (2.5.0) | |
activerecord (>= 2.3.0) | |
activesupport (>= 2.3.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) | |
cocaine (>= 0.0.2) |
#!/usr/bin/env ruby | |
# If your tables follow default Rails naming conventions (i.e. | |
# pluralized table names and #{model_name}_id foreign key names) then | |
# this script can run a quick report on your data and tell you if any | |
# of your tables contain references to non-existent rows in foreign key | |
# tables. | |
# | |
# If you had used referential integrity from the start, this script | |
# wouldn't be that useful. But for some people migrating from MySQL to |
# So this is in my controller: | |
@items = Dir.glob("views/*/*").map do |item| | |
item.gsub(/views\/.+\/(.+).haml/, '\1') | |
end.select do |item| | |
!item.match(/^hide-/) && x != "index") | |
end | |
# Its contents look like this: | |
def foo(bar) | |
# CHALLENGE: write the body of this method such that | |
# when it is invoked, the second call to 'puts' below | |
# prints something different that the first call to 'puts'. | |
# Getting hold of the Ruby bindings object or reflecting | |
# over local variables is cheating and would not demonstrate | |
# pass-by-reference. | |
end |
require 'rubygems' | |
require 'pp' | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize | |
require 'hirb' | |
extend Hirb::Console |
# Here are the params to my QuestionsController update action. | |
# accepts_nested_attributes_for is defined on the Question model | |
# for its child relationship Choice. (Question has many Choices). | |
# Adding new choices to a question in bulk as shown below works except for the order | |
# that the Choices are created in. Choices use acts_as_list and have a list_index column. | |
# The order that update_attributes (on the Question instance) creates | |
# the Choice objects is the sort order of the hash keys below. The 'new_NNNNN' id | |
# within the hash is created in JavaScript using new Date().getTime(), so it always |
# I'm testing some code that translates HTTP query params from the front end | |
# into a query against a Solr via the Sunspot API. What I want to be able to | |
# do is unit test the query translation step *without* having to have Solr running. | |
# So I thought about mocking it out, but none of the mocking frameworks seem to | |
# be able to provide a way of mocking out something passed as a block. | |
# I have some HTTP query that my code 'executes' against Solr. It should be *exactly* equivalent | |
# to running the following query against Sunspot. |