Skip to content

Instantly share code, notes, and snippets.

View glappen's full-sized avatar

Greg Lappen glappen

View GitHub Profile
var http = require('http')
var request = require('request')
http.get({host: 'odb.outbrain.com', path: '/utils/get?url=http%3A%2F%2Fwww.screenpay.com%2Foutbrain%2Fnews&widgetJSId=APP_1&key=SCREE847QHMI19G3ANGI9NHB35EBCOK&idx=0&user=3599&format=json',
headers: {'User-Agent': 'NodeJS'}}, function(adResp) {
var data = '';
adResp.on('data', function(chunk) {
data += chunk;
});
mysql> explain SELECT COUNT(*) FROM `transactions` WHERE `transactions`.`transaction_type_id` = 1 AND (device_id IN (182)) AND (`transactions`.`created_at` BETWEEN '2014-09-21 15:37:00' AND '2014-10-07 15:37:00');
+----+-------------+--------------+-------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+---------+------+-------+---------------------------------------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+-------------+----------------------------
@glappen
glappen / gist:ca27f0d3574dff3c74b9
Created September 29, 2014 16:25
new test function
func TestCompanySpecificStats(t *testing.T) {
var before *api.InternalGetStatsResult
var after *api.InternalGetStatsResult
t.Log("Starting TestCompanySpecificStats")
anotherCompany, err := data.CreateCompany(context, "Bob's Furniture", "Bob", "bob@furniture.com")
if err != nil {
t.Fatal("Could not create another company")
}
anotherCustomer, err := data.CreateUnclaimedCustomer(context, "Greg", "greg@home.net")
if err != nil {
var deferred = require('deferred');
User.find(115).success(function(user){
var categoryNamesDeferred = deferred();
user.getUserInterests().success(function(interests) {
var interestNames = [];
var innerDeferreds = [];
interests.forEach(function(interest) {
var catDeferred = deferred();
innerDeferreds.push(catDeferred);
if [ `ps ax | grep mysqld_safe | grep -v grep | wc -l` -eq 0 ]; then mysql.server start; sleep 1; fi
export GOPATH=/Users/greg/LapComInc/Timegen/Surlei/surlei/go && go run go/src/surlei/scripts/0-DropDatabase.go
Drop surleidata1
Drop surleilookup1
export GOPATH=/Users/greg/LapComInc/Timegen/Surlei/surlei/go && go run go/src/surlei/scripts/1-CreateDatabase.go
Create surleidata1
Create surleilookup1
export GOPATH=/Users/greg/LapComInc/Timegen/Surlei/surlei/go && go run go/src/surlei/scripts/2-CreateRootSuperUser.go
2014/09/23 20:19:30 Connecting DB shardset surleidata on localhost
panic: Error 1049: Unknown database 'surleidata2'
renderCompanyList: function() {
return div(
h2('Companies'),
this.state.CompanyList.length ?
table(
{border: 1},
thead(tr(th('ID'), th('Name'), th('Created'), th('OwnderRepId'))),
tbody(map(this.state.CompanyList, bind(this, function(company) {
return tr(td(company.CompanyId), td(company.Name), td(company.CreatedTime), td(company.OwnderRepId))
})))