with => temporary attach table and xtabs => summarize data attach => ex. customer_payments$amount_cents
... same as ...
attach(customer_payments)
def ampersandy(n) | |
yield n | |
end | |
ampersandy(10) do |x| | |
x + 10 | |
end | |
# => 20 | |
l = lambda { |x| x + 10 } |
def return_proc | |
p = Proc.new { return "Now you see me" } | |
p.call | |
return "Now you don't!" | |
end | |
return_proc | |
# => "Now you see me" | |
def return_lambda |
require "csv" | |
CSV.parse(DATA, headers: true).each do |row| | |
puts row["kURL"] | |
end | |
__END__ | |
kId,kName,kURL | |
1,Google UK,http://google.co.uk | |
2,"Yahoo, UK",http://yahoo.co.uk |
no_nas <- complete.cases(something_with_nas) |
# Disable the default XML params parser - its full of holes | |
ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) |
var today = new Date(); | |
console.log("today: " + today); | |
console.log("today.getTime(): " + today.getTime()); | |
console.log("today.toISOString(): " + today.toISOString()); | |
console.log("today.getTimezoneOffset(): " + today.getTimezoneOffset()); # returns in number of minutes | |
console.log("today.getTimezoneOffset() * 60 * 1000: " + today.getTimezoneOffset() * 60 * 1000) # num mins * 60 = sec * 1000 to play nice w/ #getTime() | |
today.setTime(today.getTime() - (today.getTimezoneOffset() * 60 * 1000)); | |
console.log("today.toISOString(): " + today.toISOString()); |
class SomeClass < Struct.new(:first_name, :last_name) | |
def initialize(first_name, last_name) | |
super(first_name, last_name) | |
end | |
end | |
sc = SomeClass.new("jeff", "iacono") | |
# => #<struct SomeClass first_name="jeff", last_name="iacono"> | |
sc['first_name'] |
function strltrim() { | |
return this.replace(/^\s+/,''); | |
} | |
function strrtrim() { | |
return this.replace(/\s+$/,''); | |
} | |
function strtrim() { | |
return this.replace(/^\s+/,'').replace(/\s+$/,''); |
#!/bin/bash | |
# usage: | |
# | |
# ./pinger-notifier.sh url_1 [url_2 ...] | |
# | |
# this use https://github.com/jeffreyiacono/pinger and assumes | |
# it's setup via the command line (see: https://github.com/jeffreyiacono/pinger#usage) | |
set -e |