This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Stats | |
def select_metrics(metrics) | |
metrics.inject(self) do |ds, metric| | |
ds.select_metric(metric) | |
end | |
end | |
def select_metric(metric) | |
case metric | |
when 'total' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
// Source: https://github.com/cowboy/jquery-bbq/blob/master/jquery.ba-bbq.js | |
// | |
// Section: Deparam (from string) | |
// | |
// Method: jQuery.deparam | |
// | |
// Deserialize a params string into an object, optionally coercing numbers, | |
// booleans, null and undefined values; this method is the counterpart to the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
/* Update date_input plugin so that DD-MM-YYYY format is used. */ | |
$.extend($.fn.datepicker.defaults, { | |
parse: function (string) { | |
var matches; | |
if ((matches = string.match(/^(\d{2,2})\-(\d{2,2})\-(\d{4,4})$/))) { | |
return new Date(matches[3], matches[2] - 1, matches[1]); | |
} else { | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env ARCHFLAGS="-arch x86_64" gem install pg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
→ rspec spec/models/profile_match_spec.rb | |
F* | |
Pending: | |
ProfileMatch.match matches all motives | |
# cant spec query chain | |
# ./spec/models/profile_match_spec.rb:46 | |
Failures: | |
1) ProfileMatch.match matches against all companies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# football | |
sm_home_win: | |
name: "1" | |
pick_type_category: sm | |
position: 1 | |
sm_away_win: | |
name: "2" | |
pick_type_category: sm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief Splits an address string containing a street, number and number addition | |
* | |
* @param $streetStr string An address string containing a street, number (optional) and number addition (optional) | |
* | |
* @return array Data array with the following keys: street, number and numberAddition. | |
*/ | |
private function split_street($streetStr) { | |
$aMatch = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// trims given array recursively from empty values | |
function array_trim($array) { | |
foreach ($array as $key => $value): | |
if(is_array($value)) { | |
$array[$key] = array_trim($value); | |
if(!count($array[$key])) unset($array[$key]); | |
} else { | |
if (empty($value)) unset($array[$key]); | |
} | |
endforeach; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* as described on: http://perishablepress.com/press/2009/12/06/new-clearfix-hack/ */ | |
/* new clearfix */ | |
.clearfix:after { | |
visibility: hidden; | |
display: block; | |
font-size: 0; | |
content: " "; | |
clear: both; | |
height: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# posts_controller_test.rb | |
require 'test_helper' | |
class PostsControllerTest < ActionController::TestCase | |
context "on GET to :index" do | |
setup do | |
@first_post = Factory(:post, :title => "My first post") | |
@second_post = Factory(:post, :title => "My second post") | |
get :index |