Skip to content

Instantly share code, notes, and snippets.

@stanleyhlng
stanleyhlng / README-Template.md
Created March 30, 2017 17:47 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

➜ screwdriver-cd cat docker-compose.yml
version: '2'
services:
api:
#image: screwdrivercd/screwdriver:latest
build:
context: ./screwdriver/
dockerfile: Dockerfile
ports:
{
"id": 1,
"environment": {},
"eventId": 1,
"jobId": 1,
"number": 1483653820676,
"container": "buildpack-deps",
"cause": "Started by user stanleyhlng",
"sha": "d3e8691d7082e00c36405326427b37bb2c6daa97",
"commit": {
@stanleyhlng
stanleyhlng / gist:9dfbff80c8ec67fea5c50d64b4f79c3d
Created December 20, 2016 08:41 — forked from carlosmcevilly/gist:2221249
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
{
"fields": [
{
"name": "name1",
"groupby_rank": "0"
},
{
"name": "name2",
"groupby_rank": "1"
},
@stanleyhlng
stanleyhlng / transpose.js
Last active September 9, 2016 06:01
Transpose columns to rows and vice versa.
function transposeCols2Rows(cols) {
var rows = [];
cols.forEach(function (col) {
col.forEach(function (key, idx) {
if (!rows[idx]) {
rows[idx] = [];
}
rows[idx].push(key);
});
});
cat commands.txt
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
"sleep 1"
console.log('test-unflatten.js');
var data = {
root_2: {
leaf: true,
order: 2,
parent: "root",
link: "http://financecontributors.tumblr.com/",
title: "Contributors"
},
➜ tdv2-service-nav git:(remote-yql) babel-node performance/nav-yahoo.js
tdv2-service-nav@1.0.61
```
app:yahoo | cache=0 | cache_client=? x 68.16 ops/sec ±2.51% (63 runs sampled)
app:yahoo | cache=1 | cache_client=lrucache x 2,435 ops/sec ±3.35% (81 runs sampled)
app:yahoo | cache=1 | cache_client=memcache x 1,901 ops/sec ±2.37% (81 runs sampled)
Fastest is app:yahoo | cache=1 | cache_client=lrucache
# How to upload local db to meteor:
# -h = host, -d = database name, -o = dump folder name
mongodump -h 127.0.0.1:3002 -d meteor -o meteor
# get meteor db url, username, and password
meteor mongo --url myapp.meteor.com
# -h = host, -d = database name (app domain), -p = password, meteor = the path to the dumped db folder name
mongorestore -u client -h production-db-a2.meteor.io.meteor.com:27017 -d myapp_meteor_com -p 'password' meteor/