Skip to content

Instantly share code, notes, and snippets.

Bryant Chou sansmischevia

Block or report user

Report or block sansmischevia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sansmischevia
sansmischevia / mixpanel-last-touch-UTM.js
Last active Mar 21, 2018
Mixpanel Last Touch UTM tracking
View mixpanel-last-touch-UTM.js
function getQueryParam(url, param) {
// Expects a raw URL
param = param.replace(/[[]/, "\[").replace(/[]]/, "\]");
var regexS = "[\?&]" + param + "=([^&#]*)",
regex = new RegExp(regexS),
results = regex.exec(url);
if (results === null || (results && typeof(results[1]) !== 'string' && results[1].length)) {
return '';
} else {
return decodeURIComponent(results[1]).replace(/\W/gi, ' ');
View mixpanel-last-touch-UTM.js
function getQueryParam(url, param) {
// Expects a raw URL
param = param.replace(/[[]/, "\[").replace(/[]]/, "\]");
var regexS = "[\?&]" + param + "=([^&#]*)",
regex = new RegExp(regexS),
results = regex.exec(url);
if (results === null || (results && typeof(results[1]) !== 'string' && results[1].length)) {
return '';
} else {
return decodeURIComponent(results[1]).replace(/\W/gi, ' ');
View test.html
<style>
::selection {
background: #000; /* WebKit/Blink Browsers */
color: white;
}
@sansmischevia
sansmischevia / bryant.key
Last active Nov 30, 2017
Webflow Infrastructure Project
View bryant.key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8zm/C7tp8ke37hapZbzhCzCOd9UfajpEjih42QxcgX60NQc2P99FyOLwFavXBps/jq+kXC7tEnXSD1qUvxAWg4X5/zKGRokbYvG5b9f4SwBIWEYOOdXn+iZYSadeQRGPMrDvDPSeaZVN372F8BLx0YYxb0sJ9pO3XTbz4E+ngyw+dp99PP/AVwMJZeStkPwp8wM6FQ9JkPsBHRMkgsu2HPi62VVs9R+itzj11MVaQmax/Kvlp/JxFe0S2ANixBNYcTE9yO0AxCIMMFplMjO/XK0Ae552SHnzroO3KRqw3eD9Aapm+/YrEMIA9cUmwwDS2byWQfFJd356y4AwM4b5F chou.bryant@gmail.com
@sansmischevia
sansmischevia / cluster.js
Last active Aug 29, 2015
Cluster script that I wrote for both Vungle and Webflow to cluster node apps. This code is running on hundreds of nodes with no issues. Supports worker disconnect timeout and a daily process restart as well.
View cluster.js
var cluster = require('cluster');
var os = require('os');
var http = require('http');
var workers = [];
var startCount = 0;
var TIMEOUT = 10000; // Wait 10 seconds for workers to disconnect
var RESTART = 86400000; // 24 hours
var intervalId;
View wf-stripe-connect.js
var self = <My Model>;
var stripeOpts = {
description: self.getStripeDescription(subject),
email: self.email,
metadata: self.generateStripeMetadata(subject),
// acct_ ...
stripe_account: subject.managedAccountId
};
@sansmischevia
sansmischevia / nginx.elb.conf
Last active Aug 29, 2015
Safe ELB proxy_pass with nginx
View nginx.elb.conf
location / {
set $backend "<ELB_A_RECORD?";
proxy_pass http://$backend$uri;
...
}
@sansmischevia
sansmischevia / gist:0ad030880fdf7bbda284
Created Jan 20, 2015
/Library/Ruby/Gems/2.0.0/gems/
View gist:0ad030880fdf7bbda284
/Library/Ruby/Gems/2.0.0/gems ᐅ ll
total 0
drwxr-xr-x 10 bryantchou1 wheel 340B Jan 19 14:53 builder-3.2.2
drwxr-xr-x 11 root wheel 374B Jan 19 16:25 chef-12.0.3
drwxr-xr-x 8 bryantchou1 wheel 272B Jan 19 14:49 chef-zero-3.2.1
drwxr-xr-x 7 bryantchou1 wheel 238B Jan 19 14:49 coderay-1.1.0
drwxr-xr-x 19 bryantchou1 wheel 646B Jan 19 14:49 diff-lcs-1.2.5
drwxr-xr-x 14 bryantchou1 wheel 476B Jan 19 14:49 erubis-2.7.0
drwxr-xr-x 15 bryantchou1 wheel 510B Jan 19 14:53 excon-0.43.0
drwxr-xr-x 12 bryantchou1 wheel 408B Jan 19 14:49 ffi-1.9.6
View gist:e04fe20bf6623cc04361
Building native extensions. This could take a while...
ERROR: Error installing knife-ec2:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150119-12518-1qmgu0.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
checking for iconv... yes
************************************************************************
View mongo-dynamo.js
var ObjectID = require('mongodb').ObjectID;
var configHelper = /* redacted */;
var config = require('config');
var mongodb = require('mongodb');
var MongoClient = mongodb.MongoClient;
var lib = /* redacted */;
// Map of database connection keyed by collection's tenantId
var databaseConnectionMap = {};
You can’t perform that action at this time.