A TopoJSON file of time zones, derived from https://github.com/evansiroky/timezone-boundary-builder. Simplified using Mapshaper.
CSV table from IBM - Time zone IDs that can be specified for the user.timezone property.
A TopoJSON file of time zones, derived from https://github.com/evansiroky/timezone-boundary-builder. Simplified using Mapshaper.
CSV table from IBM - Time zone IDs that can be specified for the user.timezone property.
| // API documentation, https://developers.hubspot.com/docs/methods/forms/submit_form | |
| const convertToFormData = (data) => Object.entries(data).reduce((formData, entry) => { | |
| const [key, value] = entry; | |
| if (value !== null && typeof value === 'object') { | |
| formData.append(key, JSON.stringify(value)); | |
| } else { | |
| formData.append(key, value); | |
| } | |
| return formData; |
| # https://codereview.stackexchange.com/questions/200870/powershell-script-to-deploy-repository-to-salesforce | |
| param([string] $repositoryDirectory, [bool] $isProduction) | |
| # TODO - git integration. Select a branch and check it out for deploy. | |
| # TODO - break stuff into functions and reusable pieces. ¿piping? ¿cmdlets? | |
| # TODO - Allow directory structures? | |
| Write-Host -ForegroundColor green ":: Validating Repository ::" | |
| $srcDirectory = [System.IO.Path]::Combine($repositoryDirectory, "src") |
| # -*- coding: utf-8 -*- | |
| import os | |
| import StringIO | |
| import hashlib | |
| try: | |
| from boto.s3.connection import S3Connection | |
| from boto.s3.key import Key | |
| except ImportError: | |
| raise ImproperlyConfigured, "Could not load Boto's S3 bindings." |
| COUNTRIES_WITHOUT_POSTCODES = [ | |
| [ "Angola", "AO" ], | |
| [ "Antigua and Barbuda", "AG" ], | |
| [ "Aruba", "AW" ], | |
| [ "Bahamas", "BS" ], | |
| [ "Belize", "BZ" ], | |
| [ "Benin", "BJ" ], | |
| [ "Bolivia", "BO" ], | |
| [ "Botswana", "BW" ], | |
| [ "Burkina Faso", "BF" ], |
| // Dave's AMPScript cheat sheet. | |
| // AMPScript is ExactTarget (SFDC Marketing Cloud)'s server side scripting language. | |
| // It's a bit of a pig, plus the docs are numerous and the examples aren't contextual. | |
| // This assumes you don't need hand holding, and just need to get your head around it. | |
| // It's also my reference for the snippets I use all the time (I'm a formatting stickler). | |
| // These examples come from microsites I've written - adapt 'em for use elsewhere. | |
| // Multi line AMPScript %%[contained within delimiters]%% gets interpreted on the server. |
| // Taken from http://developers.marketo.com/blog/restrict-free-email-domains-on-form-fill-out/ | |
| // Prepared by Ian Taylor and Murtza Manzur on 9/9/2014 - Modified Dillan Simmons 8/15/17 | |
| (function (){ | |
| // Please include the email domains you would like to block in this list | |
| var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook.","@test."]; | |
| MktoForms2.whenReady(function (form){ | |
| form.onValidate(function(){ | |
| var email = form.vals().Email; |
| # first: mkdir user && cd user && cp /path/to/get_gists.py . | |
| # python3 get_gists.py user | |
| import requests | |
| import sys | |
| from subprocess import call | |
| user = sys.argv[1] | |
| r = requests.get('https://api.github.com/users/{0}/gists'.format(user)) |
This is an example of how to process data in hierarchical structures using either recursion or a stack based approach. To examplify this we will use a didactical example: find the maximum number in an array of arrays. The same techniques can be used to find / process data in other hierarchical structure such as XML documents, JSON objects, etc.
type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];