Skip to content

Instantly share code, notes, and snippets.

View papagunit's full-sized avatar
👨‍🚀
Don't mind me, just collecting stars...

Devon Guerrero papagunit

👨‍🚀
Don't mind me, just collecting stars...
View GitHub Profile
@atav32
atav32 / post_hubspot_form.js
Created August 29, 2018 22:27
POST form data to HubSpot API
// 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;
@manzanit0
manzanit0 / deploy.ps1
Last active December 7, 2022 17:08
PowerShell Script to deploy repository to Salesforce. It uses SFDX CLI.
# 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")
@CreetureFeeture
CreetureFeeture / S3 bucket sync
Created May 16, 2018 16:48 — forked from andrewschoen/S3 bucket sync
Python script to sync an S3 bucket to the local file system
# -*- 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" ],
@CreetureFeeture
CreetureFeeture / ampscript cheat sheet.txt
Created August 21, 2017 18:12 — forked from FaldoAU/ampscript cheat sheet.txt
Dave's AMPScript Cheat Sheet
// 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.
@dillansimmons
dillansimmons / RestrictFreeMail_Marketo.js
Last active June 11, 2020 19:47
Restrict free email addresses: Marketo
// 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;
@leoloobeek
leoloobeek / get_gists.py
Created April 26, 2017 21:34
Download all gists for a specific user
# 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))
@mveteanu
mveteanu / README.MD
Last active February 22, 2022 00:57
Process hierarchical data using recursion or stack

Process hierarchical data using recursion or stack

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.

@hediet
hediet / main.md
Last active October 20, 2025 05:46
Proof that TypeScript's Type System is Turing Complete
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"];