Skip to content

Instantly share code, notes, and snippets.

View poxrud's full-sized avatar

Phil Oxrud poxrud

View GitHub Profile
@poxrud
poxrud / cookie_parser
Last active May 28, 2020 17:38
Simple Cookie String Parser in JS
function debounce(func, delay) {
var alreadyScheduled;
var lastTimer;
return function() {
if (alreadyScheduled) {
clearTimeout(lastTimer);
}
@poxrud
poxrud / iso_3166_country_codes.rb
Last active February 4, 2022 17:45
Get a comma separated list of ISO 3166 Country Codes. (example: AF,AX,AL,DZ...)
require 'net/http'
uri = URI('https://pkgstore.datahub.io/core/country-list/data_csv/data/d7c9d7cfb42cb69f4422dec222dbbaa8/data_csv.csv')
countries = Net::HTTP.get(uri)
countries = countries.split("\r\n").drop(1)
countries = countries.map do |country|
country.split(",").last
end.join(",")