This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE demo; | |
/* DEMO FOR TRACKING HISTORY */ | |
DROP TABLE IF EXISTS users; | |
DROP TABLE IF EXISTS user_history; | |
DROP PROCEDURE IF EXISTS append_user_history; | |
CREATE TABLE users ( | |
user_id int NOT NULL AUTO_INCREMENT PRIMARY KEY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE demo; | |
USE demo; | |
#Let's get some data | |
CREATE TABLE video_games ( | |
video_game_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
title varchar(200) NOT NULL, | |
developer varchar(200) NOT NULL, | |
platform varchar(100) NOT NULL, | |
release_date date NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates a signed query string for getting private S3 files | |
// See "Query String Request Authentication Alternative" in https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html | |
// Node requirements | |
const crypto = require('crypto'); | |
const querystring = require('querystring'); | |
// Parameters | |
const AWS_BUCKET = 'my-bucket'; | |
const AWS_KEY = 'MY:AWS:KEY'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* visitors who were never seen as a lead or member */ | |
SELECT count(distinct v_orig.visitor_cookie_id) | |
FROM videoblocks.abtest_members v_orig | |
LEFT JOIN videoblocks.abtest_members v_ul | |
ON v_orig.visitor_cookie_id = v_ul.visitor_cookie_id | |
AND v_orig.test_id = v_ul.test_id | |
AND v_orig.id <> v_ul.id | |
AND v_ul.user_lead_id IS NOT NULL | |
LEFT JOIN videoblocks.abtest_members v_m | |
ON v_orig.visitor_cookie_id = v_m.visitor_cookie_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS word_match_test; | |
CREATE TABLE word_match_test ( | |
word varchar(63), | |
FULLTEXT INDEX IX_word_match_test_word (word) | |
) ENGINE=MyISAM; | |
INSERT INTO word_match_test (word) | |
VALUES ('test butterfly mouse kitten test'), | |
('test butterflymore mousemore test'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
//code from http://stackoverflow.com/questions/8628522/placeholder-not-working-for-internet-explorer | |
var _debug = false; | |
var _placeholderSupport = function() { | |
var t = document.createElement("input"); | |
t.type = "text"; | |
return (typeof t.placeholder !== "undefined"); | |
}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var csv = require('csv'); | |
var fs = require('fs'); | |
var os = require('os'); | |
var path = require('path'); | |
var ENABLE_PAUSING = true; | |
var testFilePath = path.join(os.tmpDir(),'test.csv'); | |
console.log('Creating test csv temp file'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = ['a','b'] | |
//[ 'a', 'b' ] | |
obj = {a: arr[0], b: arr[1], c: arr[2]} | |
//{ a: 'a', b: 'b', c: undefined } | |
JSON.stringify(obj) | |
//'{"a":"a","b":"b"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Beware that the orer of set operations in MySQL are evaluated from left to right for updating a single table, | |
and in no guarenteed order when updating multiple tables at once through a join. | |
http://dev.mysql.com/doc/refman/5.7/en/update.html | |
*/ | |
DROP TABLE IF EXISTS test; | |
CREATE TABLE test ( | |
num1 int, |