Skip to content

Instantly share code, notes, and snippets.

@grosscorporation
grosscorporation / falsey.js
Created June 29, 2020 00:17
JavaScript Truthy and Falsey
function falsey( val ) {
return !(
val === 'undefined' ||
val === undefined ||
val === false ||
val === "false" ||
val === "off" ||
val === "OFF" ||
val === "Off" ||
val === null ||
@grosscorporation
grosscorporation / Object.compare.js
Last active September 5, 2021 17:32
Compare two objects recursively, including DOM references and methods
Object.compare = function (premise, supplement) {
for (let p in premise) {
if(premise.hasOwnProperty(p)){
if (premise.hasOwnProperty(p) !== supplement.hasOwnProperty(p)) return false;
switch (typeof (premise[p])) {
case 'object':
if (!Object.compare(premise[p], supplement[p])) return false;
@grosscorporation
grosscorporation / Parse._linkWith.js
Last active September 30, 2019 01:01
Parse Server Signup
const authData = {
"id": profile.getId(),
"id_token": id_token
}
const options = {
"authData": authData
}
const user = new Parse.User();
user._linkWith('google', options).then(function(user) {
console.log('Successful user._linkWith(). returned user=' + JSON.stringify(user))
@grosscorporation
grosscorporation / mongodb-s3-backup.sh
Last active August 9, 2019 01:12 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@grosscorporation
grosscorporation / Free non-commercial email provider primary domains
Last active August 8, 2019 07:23
Verymail list of domains for "free or public" email providers who we consider non-commercial or "not for company" email domains. Most domains belong to mail.com and ones not included here can be queried using our verymail package
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com
@grosscorporation
grosscorporation / 1.mongodb-aws-setup-guide.md
Created December 25, 2018 07:23 — forked from calvinh8/1.mongodb-aws-setup-guide.md
MongoDB Setup Guide for AWS EC2 Instances with Auth Enabled
@grosscorporation
grosscorporation / parse-server-cloud-http.js
Created August 4, 2018 03:57
parse server complete cloud http single thread
let now = new Date ();
let ISODate = new Date ( now.toISOString () );
let TimeStamp = ISODate.getTime ();
let api_access_key = "api_access_key";
let api_secret_key = "api_secret_key";
let url = "https://test-emoney-services.w-ha.com/api/";
let body = {
"subscriber" : {
"lastname" : "Martin",
"firstname" : "Philippe",
@grosscorporation
grosscorporation / nodejs-request.js
Last active August 4, 2018 03:56
HMAC-SHA256 signature crypto
let now = new Date ();
let ISODate = new Date ( now.toISOString () );
let TimeStamp = ISODate.getTime ();
let api_access_key = "key1";
let api_secret_key = "key2";
let url = "https://test-emoney-services.w-ha.com/api/";
let body = {
"subscriber" : {
"lastname" : "Martin",
"firstname" : "Philippe",
@grosscorporation
grosscorporation / Delete-Clear-all-cookies.js
Created July 16, 2018 16:30
Delete, Clear all cookies including variants of www prefixed domains
(function () {
var cookies = document.cookie.split("; ");
for (var c = 0; c < cookies.length; c++) {
var d = window.location.hostname.split(".");
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
var p = location.pathname.split('/');
document.cookie = cookieBase + '/';
while (p.length > 0) {
document.cookie = cookieBase + p.join('/');
@grosscorporation
grosscorporation / Country Currency Codes JSON
Last active May 9, 2022 10:02
currency symol, name, plural, and decimal digits for all major and minor currencies
[
{
"USD" : {
"symbol" : "$",
"name" : "US Dollar",
"symbol_native" : "$",
"decimal_digits" : 2,
"rounding" : 0,
"code" : "USD",
"name_plural" : "US dollars"