Skip to content

Instantly share code, notes, and snippets.

@alansparrow
alansparrow / pythonmanagemigrate.py
Created January 20, 2016 10:04
python manage.py migrate
http://stackoverflow.com/questions/11365619/psycopg2-installation-error-library-not-loaded-libssl-dylib
@alansparrow
alansparrow / findportmac.js
Created January 11, 2016 20:23
Find Running Port MacOS
lsof -i :80 # checks port 80
@alansparrow
alansparrow / nodelogger.js
Created December 31, 2015 17:25
Node Logger
var Logger = require('tracer').colorConsole();
@alansparrow
alansparrow / login.test.js
Created December 31, 2015 09:17 — forked from joaoneto/login.test.js
Login session test with mocha
var request = require('supertest'),
should = require('should'),
app = require('../server');
var Cookies;
describe('Functional Test <Sessions>:', function () {
it('should create user session for valid user', function (done) {
request(app)
.post('/v1/sessions')
@alansparrow
alansparrow / python.py
Created December 4, 2015 22:26
python package manager pyenv pip install
pyenv global 2.7.10
go to ~/.bash_profile:
export PYENV_VERSION=2.7.10
pip install pynum
@alansparrow
alansparrow / docker-mongod-nodejs.js
Created November 11, 2015 00:16
docker mongod nodejs
docker run -p 80:4000 -t -i baotrungtn/ubuntu:init-state bash -c "mongod & node /home/confidence/app.js"
@alansparrow
alansparrow / docker-multiple-cmd.js
Created November 6, 2015 18:02
docker multiple cmd
docker run -p 80:4000 baotrungtn/ubuntu:online-mongodb bash -c 'mongod --fork --logpath /home/confidence/mongodb.log && nodemon /home/confidence/app.js'
docker run -p 80:4000 baotrungtn/ubuntu:online-mongodb bash -c 'mongod --fork --logpath /home/confidence/mongodb.log && node /home/confidence/app.js'
@alansparrow
alansparrow / gist:acdfa61c4f4dc2c27742
Created July 15, 2015 18:20
Quy trinh jamesgaraget.net / jamesgarage.net's procedure
1. Chinh link menu trong giao dien goc Wordpress (Look & Feel -> Menu -> Category)
2. Chinh footer trong giao dien extended (Tu giao dien goc -> PUBLISH -> Portfolio -> Appearance -> Widgets
Quy trinh post
1. Tao anh quang cao
2. Post Album xe va anh dia chi, gioi thieu len Google Photos
3. Dat ten cho Album tren Google Photos
4. Post bai moi tren Wordpress voi title giong title album tren Google Photos
5. Chon Featured Image la anh quang cao xe
6. Them Link More pictures trong bai post moi (link den Google Photos Album, nho chon Open in New Windows)
@alansparrow
alansparrow / mongo_backup.js
Created April 18, 2015 23:16
mongodump mongorestore mongo backup
mongodump
mongorestore --collection people --db accounts dump/accounts/people.bson
@alansparrow
alansparrow / mongodb-query.js
Created April 14, 2015 17:59
mongodb query nice
Post.findOne({
"_id" : postId
}, "_comments")
.populate({
path: "_comments",
select: "ownerName content postDate commentType",
options: { limit: commentCount, sort: { "postDate" : -1 } }
})
.exec(function(err, post) {
if (err || !post) {