This file contains hidden or 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
class String | |
# http://confreaks.com/videos/1228-aloharuby2012-keynote-rails-4-and-the-future-of-web | |
def t13d | |
if length > 2 | |
return "#{self[0,1]}#{(length - 2)}#{self[-1,1]}" | |
else | |
return self | |
end | |
end | |
end |
This file contains hidden or 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
<?php | |
function foo($bar = NULL) { | |
if (isset($bar)) { | |
print "bar is set\n"; | |
var_dump($bar); | |
} | |
else { | |
print "bar is not set\n"; | |
var_dump($bar);//If not set should throw at least a NOTICE. |
This file contains hidden or 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
php> $are_you_insane_php = (int) 'hello world' | |
php> var_dump($are_you_insane_php) #=> int(0) |
This file contains hidden or 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
<?php | |
$amount = 17.50; | |
print (int) $amount * 100; # => 1700 # My implementation. I was wrong. | |
print (int) ($amount * 100); # => 1750 # After bugfix. PHP first casts, then multiplies. |
This file contains hidden or 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
6ff235b69503dc6c7b1df425c003413c |
This file contains hidden or 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
Spree::Product.class_eval do | |
def self.simple_scopes | |
[ | |
:ascend_by_random, | |
:ascend_by_updated_at, | |
:descend_by_updated_at, | |
:ascend_by_name, | |
:descend_by_name, | |
# Need to have master price scopes here | |
# This makes them appear in admin/product_groups/edit |
This file contains hidden or 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
1) SomeBarsController GET 'index' should be successful | |
Failure/Error: get 'index' | |
ActionController::RoutingError: | |
No route matches {:controller=>"some_bars"} | |
2) SomeBarsController GET 'index' should render Hello World | |
Failure/Error: get 'index' | |
ActionController::RoutingError: | |
No route matches {:controller=>"some_bars"} |
This file contains hidden or 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
$client = new SoapClient($cad_url); | |
$count = count($args); | |
if ($count == 0) { | |
$response = $client->$method(); | |
} | |
elseif ($count == 1) { | |
$response = $client->$method($args[0]); | |
} | |
elseif ($count == 2) { | |
$response = $client->$method($args[0], $args[1]); |
This file contains hidden or 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
.page-CENSORED #edit-somefield-wrapper label { | |
background: url(../images/required.gif) 40px top no-repeat; | |
} | |
This file contains hidden or 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
<div id="block-views-news-block_3" class="block block-views first region-odd odd region-count-1 count-9 with-block-editing"> | |
<div class="content"> | |
<div class="views_view view view-news view-id-news view-display-id-block_3 view-dom-id-3"> | |
<div class="views-admin-links views-hide"> |