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
docker-machine Notes | |
Download docker-machine binary from: | |
https://github.com/cloudnativeapps/machine/releases | |
(not: https://github.com/docker/machine/releases) | |
OR - build it yourself by cloning and following the build instructions at the bottom of the README.md: | |
https://github.com/docker/machine | |
Move the downloaded binary to: | |
/usr/local/bin/docker-machine |
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
# test failed create due to validation | |
require 'awesome_print' # support 'ap' | |
sli = nil | |
Octopus.using(LassoDbSharding.key(ShoppingListItem, Retailer.find(767))) do | |
ap sli = ShoppingListItem.create() | |
ap sli.errors | |
end |
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
cattle = ['hereford', 'angus', 'brahman', 'holstein'] | |
dogs = ['terrier', 'akita', 'poodle', 'afghan'] | |
breed = 'afghan' | |
animal_type = case breed | |
when *cattle | |
'cow' | |
when *dogs | |
'dog' |
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
/** | |
* @returns {boolean} true if this is an iOS device running 'version' or greater | |
*/ | |
function is_iOS_app_gte(version) { | |
return typeof window.device != "undefined" && window.device.platform == "iOS" && is_version_gte(window.device.version, version); | |
} | |
/** | |
* Is this an Apple iOS device and running version 7.0 or greater? |
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
/** | |
* Takes two version numbers with multiple decimal points (e.g. '7.0.3') and | |
* returns true if the first one is greater than or equal to the second. | |
* | |
* @param v1 version that should be greater than or equal | |
* @param v2 version that should be less than or equal | |
* @returns {boolean} true if 'v1' >= 'v2' | |
*/ | |
function is_version_gte(v1, v2) { | |
var v1_parts = (v1 || 0).toString().split('.').map(function(s) {return parseInt(s)}); |
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
hash = { | |
:key1 => <<-END_VAL, | |
console.log('cow'); | |
alert('moof!'); | |
END_VAL | |
:key2 => <<-END_VAL | |
console.log('cow 2'); | |
alert('moof! 2'); | |
END_VAL | |
} |
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
# Register - Step 1 (login): Authenticate using fuzzy card number as 'login' and last name as 'password' (note auth will fail if Card.Reg == 1 already) | |
curl -i -H "Accept: application/json" -X POST -d "api_user_session[retailer_id]=767&api_user_session[type]=Card&api_user_session[login]=40000000197&api_user_session[password]=Vandalay" http://local.webstophq.com:3000/api/v1/login | |
# Register - Step 2 (get preferred store list): Gets list of {:id, :store_number, :address_1, :city, :store_name} | |
GET /api/v1/retailers/:retailer_id/stores(.:format) | |
curl -i -H "Accept: application/json" http://local.webstophq.com:3000/api/v1/retailers/767/stores?api_user_credentials=tozaqJaMRDKPjXPWhDh | |
# Register - Step 3 (update consumer): Mark Consumer (Card) as registered and set preferred store and password - then return the Consumer (Card) including new single_access_token and legacy_token | |
PUT /api/v1/retailers/:retailer_id/consumers/:id(.:format) | |
curl -i -H "Accept: application/json" -X PUT -d "consumer[registered]=1&co |
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
require'socket' | |
server = TCPServer.new(8088); | |
loop do | |
connection = server.accept | |
puts 'Trapped a new connection' | |
end |
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
1.9.2p320 :001 > s = "test: string with @ref and @ref2 in it" | |
=> "test: string with @ref and @ref2 in it" | |
1.9.2p320 :002 > s.scan(/(?<=@)\w+/) | |
=> ["ref", "ref2"] | |
1.9.2p320 :003 > s.scan(/@(\w+)/) | |
=> [["ref"], ["ref2"]] |
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
erb_eval_mode = line =~ /^%ERB_START_EVAL/ if line =~ /^%ERB_START_EVAL|%ERB_STOP_EVAL/ | |
if line =~ /^%ERB_START_EVAL/ | |
erb_eval_mode = true | |
if line =~ /^%ERB_STOP_EVAL/ | |
erb_eval_mode = false |