using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
#!/bin/bash | |
THE_DATE=$(date) | |
echo $THE_DATE |
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
#! /usr/bin/env python | |
import redis | |
import random | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6379) | |
REDIS_SETGET = False | |
REDIS_HSET = False |
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
sudo apt-get install libsnappy-dev | |
wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz | |
tar -xzf leveldb-1.9.0.tar.gz | |
cd leveldb-1.9.0 | |
make | |
sudo mv libleveldb.* /usr/local/lib | |
cd include | |
sudo cp -R leveldb /usr/local/include |
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
<?php | |
namespace App\Http\Controllers; | |
use Warrenca\Laravel\Repositories\UserRepository; | |
/** | |
* Class CompanyUserController | |
*/ |
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
#!/bin/bash | |
docker stop etcd; docker rm etcd; docker run -d -p 4001:4001 -p 2380:2380 -p 2379:2379 \ | |
--name etcd quay.io/coreos/etcd /usr/local/bin/etcd \ | |
-name etcd0 \ | |
-advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ | |
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://${HostIP}:2380 \ | |
-listen-peer-urls http://0.0.0.0:2380 \ | |
-initial-cluster-token etcd-cluster-1 \ | |
-initial-cluster etcd0=http://${HostIP}:2380 \ |
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 process(callback) { | |
var name = "john"; | |
if (name==="john") { | |
callback(null, "My name is john"); | |
} else { | |
callback("I am not john"); | |
} | |
} | |
process(function(error, message) { |
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
async function process() { | |
let name="john"; | |
if (name==="john") { | |
return Promise.resolve("My name is john"); | |
} else { | |
return Promise.reject("I am not john"); | |
} | |
} | |
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
// Restify Server CheatSheet. | |
// More about the API: http://mcavage.me/node-restify/#server-api | |
// Install restify with npm install restify | |
// 1.1. Creating a Server. | |
// http://mcavage.me/node-restify/#Creating-a-Server | |
var restify = require('restify'); |
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
#!/usr/bin/python | |
""" | |
Create a stage in your project, make it the last stage. | |
Make a task in the stage with this inline script: | |
#! /bin/bash | |
/some/path/bamboo-to-slack.py "${bamboo.planKey}" "${bamboo.buildPlanName}" "${bamboo.buildResultsUrl}" |
NewerOlder