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
// attach ctm event | |
var EventSource = null; | |
window.CTMSourceEvent = function(event) { | |
if (event.state != "before") { return } | |
EventSource = event.rule[2]; // capture the event source in a global | |
} | |
// form validation function | |
function validateForm() { | |
successFlag = true; |
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
libTwilioClient.a: Mach-O universal binary with 4 architectures | |
libTwilioClient.a (for architecture armv7): current ar archive random library | |
libTwilioClient.a (for architecture armv7s): current ar archive random library | |
libTwilioClient.a (for architecture i386): current ar archive random library | |
libTwilioClient.a (for architecture x86_64): current ar archive random library | |
# see no arm64 |
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 writeSpeedAverage() { | |
if (window.performance && typeof(window.performance.now) == 'function') { | |
var test_key = "__test_store_key__" + performance.now(); | |
var sum = 0; | |
for (var i = 0; i < 500; ++i) { // 500 iterations to get an average | |
var t0 = performance.now(); | |
localStorage[test_key] = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz_" + i + performance.now(); | |
var t1 = performance.now(); | |
sum += (t1 - t0); | |
} |
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
def any?(key) | |
value = fetch(key) | |
if value && value.respond_to?(:any?) | |
value.any? # can you guess which any? value responds to?... hint it expects more than 0 arguments. | |
else | |
!fetch(key).nil? | |
end | |
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
function initLocationInfo() { | |
var urlLocation = window.location.search; | |
var locationInfo = jQuery('.location-info'); | |
var locationTel = jQuery('.tel-location'); | |
var locationAddress = jQuery('.address-location'); | |
if(!jQuery.cookie('location')) { | |
var valueLocation; | |
if (window.__ctm && __ctm.config && __ctm.config.country) { | |
switch(__ctm.config.country) { |
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
# in some environments it's safe to turn off ssl verification in production environments never do this | |
Net::HTTP.class_eval do | |
private | |
alias default_connect connect | |
undef connect | |
def connect | |
# we're off in 1.9 that means verify_mode = OpenSSL::SSL::VERIFY_NONE | |
self.verify_mode = OpenSSL::SSL::VERIFY_NONE if self.respond_to?(:verify_mode) | |
default_connect | |
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
openssl s_client -connect api.nextcaller.com:443 | |
CONNECTED(00000003) | |
depth=0 /businessCategory=Private Organization/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/serialNumber=5208704/street=Floor 4/street=175 Varick Street/postalCode=10014/C=US/ST=New York/L=New York/O=Next Caller, Inc./CN=api.nextcaller.com | |
verify error:num=20:unable to get local issuer certificate | |
verify return:1 | |
depth=0 /businessCategory=Private Organization/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/serialNumber=5208704/street=Floor 4/street=175 Varick Street/postalCode=10014/C=US/ST=New York/L=New York/O=Next Caller, Inc./CN=api.nextcaller.com | |
verify error:num=27:certificate not trusted | |
verify return:1 | |
depth=0 /businessCategory=Private Organization/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/serialNumber=5208704/street=Floor 4/street=175 Varick Street/postalCode=10014/C=US/ST=New York/L=New York/O=Next Caller, Inc./CN=api.nextcaller.com | |
verify error:num=21:unable to verify the first c |
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
area_code=443 | |
country=US | |
# grab the first number in the list and buy it | |
phone_number=`curl -XGET -u$key:$sec "https://$host/api/v1/accounts/$account/numbers/search.json?area_code=$area_code&country_code=$country" | python -c 'import sys, json; print json.load(sys.stdin)["results"][0]["phone_number"]'` | |
echo "buy $phone_number" | |
# send the request to purchase | |
curl -XPOST -u$key:$sec https://$host/api/v1/accounts/$account/numbers.json?test=1 --data-urlencode "phone_number=$phone_number" | python -mjso | |
n.tool |
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
class Bar | |
def calls | |
['a','b','c','d'].each do|i| | |
yield i | |
end | |
end | |
def hello | |
self.calls do|call| | |
puts call |
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 FetchDb() { | |
this.db = {}; // store cached responses key'ed by method.url | |
this.pending = {}; // store pending requests to avoid stacking requests key'ed by method.url | |
} | |
FetchDb.prototype = (function() { | |
function fetchPayload(payload) { | |
var url = payload.url; | |
var body = payload.data; | |
var method = (payload.method || 'get').toLowerCase(); | |
var headers = {}; |