How to customize the humanized :category
symbol in the generated error message.
Tested with Rails 4.1
class Listing < ActiveRecord::Base
validate :premium_category
private
def premium_category
How to customize the humanized :category
symbol in the generated error message.
Tested with Rails 4.1
class Listing < ActiveRecord::Base
validate :premium_category
private
def premium_category
sum = 0 | |
[106.90, 106.90, 106.90, 106.90, 106.90, 106.90].each do |l| | |
sum += l | |
p sum | |
end | |
# Output | |
# 106.9 | |
# 213.8 | |
# 320.70000000000005 |
class MethodLogger | |
def log_method(klass, method_name) | |
klass.class_eval do | |
alias_method "#{method_name}_original", method_name | |
define_method method_name do |*args, &block| | |
puts "Called #{method_name}" | |
send "#{method_name}_original", *args, &block | |
end | |
end | |
end |
$ adduser dog
$ visudo
# This allows user to sudo but prompts for password
dog ALL=(ALL:ALL) ALL
2.2.1
source /usr/local/share/chruby/chruby.sh
chruby $(cat .ruby-version)
$ rails new my_billion_dollar_app
$ ln -s ~/Sites/my_billion_dollar_app ~/.pow/.
/*ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f8907182ef665ac560d2043d7dee9ac1f89071 |
#!/usr/bin/env ruby | |
# A script to setup a PHP dev. environment on a local MacOSX 10.6.8+ machine | |
require 'optparse' | |
# This hash will hold all of the options | |
# parsed from the command-line by | |
# OptionParser. | |
options = {} | |
optparse = OptionParser.new do |opts| |
<ol> | |
<?php foreach ($this->getItems() as $_item): ?> | |
<li> | |
<?php if ($_item->getCount() > 0): ?> | |
// Add attribute option image before label | |
<?php if($_item->getName() == "Color") : ?> | |
<img src="<?php echo Mage::helper('attributeoptionimage')->getAttributeOptionImage($_item->getValue()); ?>" alt="" /> | |
<?php endif; ?> | |
<a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a> | |
<?php else: echo $_item->getLabel() ?> |
/*! | |
* jQuery lightweight plugin boilerplate | |
* Original author: @ajpiano | |
* Further changes, comments: @addyosmani | |
* Licensed under the MIT license | |
*/ | |
// the semi-colon before the function invocation is a safety | |
// net against concatenated scripts and/or other plugins |
// How to refactor this bitch? | |
var dateCompare = function(date1, date2, operator) { | |
if(operator === ">") return date1.getTime() > date2.getTime(); | |
if(operator === "<") return date1.getTime() < date2.getTime(); | |
if(operator === "==") return date1.getTime() == date2.getTime(); | |
//And so on and so forth with the other operators (>=, <=) | |
} | |
// Different approach but moves the conditional logic out |