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 request = require('supertest'), | |
mongoose = require('mongoose'), | |
app = require('../../../../server'); | |
describe('GET /api/transactions/import', function(){ | |
before(function (done) { | |
mongoose.connection.on('open', done); | |
}); | |
it('respond with json', function(done){ |
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
# Add this to you ~/.profile | |
function tree { | |
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' | |
} | |
# Then: | |
$ source ~/.profile | |
$ tree |
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
# generate ssh key | |
ssh-keygen -t dsa | |
# (Don’t enter a passphrase unless you want to type it every time you want to use the key) | |
# set permissions | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/id_dsa | |
chmod 644 ~/.ssh/id_dsa.pub | |
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
# with netstat | |
netstat -nlp | grep :80 | |
# or with lsof | |
lsof -i :80 | grep LISTEN | |
# http://www.cyberciti.biz/faq/find-linux-what-running-on-port-80-command/ |
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
mkdir -p site-cookbooks/tomatoes/{recipes,{templates,files}/default} |
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
# 1. discover what is wrong | |
sudo nginx -t | |
# 2. fix everything | |
# 3. restart the service | |
sudo service nginx restart |
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 Produto(nome, qtd){ | |
var self = this; | |
self.Nome = nome || ''; | |
self.Qtd = qtd || 0; | |
return self; | |
} | |
var arroz = new Produto("Arroz", 10); |
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
# for <= ubuntu 12.04 | |
sudo apt-get install python-software-properties | |
# for >= ubuntu 12.10 | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:nginx/stable | |
sudo apt-get update |
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
# inline | |
[ -d "my_dir" ] && echo "Yes" || echo "No" | |
[ -f "my_file" ] && echo "Yes" || echo "No" | |
# function | |
dir_exists() { | |
( test -d $1 > /dev/null 2>&1 ) && return 0 || return 1 | |
} | |
file_exists() { |
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 node | |
var MongoClient = require('mongodb').MongoClient, | |
format = require('util').format, | |
async = require('async'); | |
MongoClient.connect('mongodb://127.0.0.1:27017/test_mongo', function(err, db) { | |
if(err) throw err; | |
var collection = db.collection('test_insert'); |