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
@duyet
duyet / duyetdev-spark-to-parquet.scala
Created September 21, 2016 03:35
Spark convert CSV to Parquet.
def convert(sqlContext: SQLContext, filename: String, schema: StructType, tablename: String) {
// import text-based table first into a data frame.
// make sure to use com.databricks:spark-csv version 1.3+
// which has consistent treatment of empty strings as nulls.
val df = sqlContext.read
.format("com.databricks.spark.csv")
.schema(schema)
.option("delimiter","|")
.option("nullValue","")
.option("treatEmptyValuesAsNulls","true")
@yellis
yellis / gist:8955467
Last active February 11, 2019 22:51
Convert 15 Char Salesforce Id to 18 Char Salesforce Id
// Based on algorithm given at http://wp.me/pWWz3-14
static string Convert15CharTo18CharId(string id)
{
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
if (id.Length == 18) return id;
if (id.Length != 15) throw new ArgumentException("Illegal argument length. 15 char string expected.", "id");
var triplet = new List<string> {id.Substring(0, 5), id.Substring(5, 5), id.Substring(10, 5)};
StringBuilder str = new StringBuilder(5);
string suffix = string.Empty;
@emptyhammond
emptyhammond / gist:1603144
Created January 12, 2012 21:11
Make a PUT request with jQuery.ajax()
$.ajax({
type: 'POST', // Use POST with X-HTTP-Method-Override or a straight PUT if appropriate.
dataType: 'json', // Set datatype - affects Accept header
url: "http://example.com/people/1", // A valid URL
headers: {"X-HTTP-Method-Override": "PUT"}, // X-HTTP-Method-Override set to PUT.
data: '{"name": "Dave"}' // Some data e.g. Valid JSON as a string
});
/* Some clients do not support PUT or it’s difficult to send in a PUT request. For these cases, you could POST the request with a request header of X-HTTP-Method-Override set to PUT. What this tells the server is that the intended request is a PUT. Obviously this relies on the API you are accessing making use of the X-HTTP-Method-Override Header.*/
0-mail.com
027168.com
0815.su
0sg.net
10mail.org
10minutemail.co.za
11mail.com
123.com
123box.net
123india.com
@P3t3rp4rk3r
P3t3rp4rk3r / disposableemailproviders
Created March 24, 2019 04:06
Free disposable email providers
0-00.usa.cc
0-mail.com
001.igg.biz
0039.cf
0039.ga
0039.gq
0039.ml
027168.com
0317123.cn
0815.ru
@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;
@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."
@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.
@Eskimon
Eskimon / countries.json
Created July 11, 2019 09:49
Countries ISO 3166 codes, names, slugs json list
[
{
"slug": "afghanistan",
"name": "Afghanistan",
"alpha2": "AF",
"alpha3": "AFG",
"numerical": "004",
"iso_3166_2": "ISO 3166-2:AF"
},
{
@devdutta
devdutta / country-codes.csv
Created June 25, 2019 05:30
Standard Country Codes
name alpha-2 alpha-3 country-code iso_3166-2 region sub-region intermediate-region region-code sub-region-code intermediate-region-code
Afghanistan AF AFG 004 ISO 3166-2:AF Asia Southern Asia 142 034
Åland Islands AX ALA 248 ISO 3166-2:AX Europe Northern Europe 150 154
Albania AL ALB 008 ISO 3166-2:AL Europe Southern Europe 150 039
Algeria DZ DZA 012 ISO 3166-2:DZ Africa Northern Africa 002 015
American Samoa AS ASM 016 ISO 3166-2:AS Oceania Polynesia 009 061
Andorra AD AND 020 ISO 3166-2:AD Europe Southern Europe 150 039
Angola AO AGO 024 ISO 3166-2:AO Africa Sub-Saharan Africa Middle Africa 002 202 017
Anguilla AI AIA 660 ISO 3166-2:AI Americas Latin America and the Caribbean Caribbean 019 419 029
Antarctica AQ ATA 010 ISO 3166-2:AQ