Skip to content

Instantly share code, notes, and snippets.

View maxcnunes's full-sized avatar
🏠
Working from home forever and ever

Max Claus Nunes maxcnunes

🏠
Working from home forever and ever
View GitHub Profile
@maxcnunes
maxcnunes / Install-nodejs-npm.sh
Created July 31, 2013 23:37
Commands to install nodejs and npm for Linux
sudo apt-get remove nodejs nodejs-dev npm
sudo add-apt-repository ppa:richarvey/nodejs
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm
nodejs -v #outputs v0.10.13
npm -v #outputs v1.3.3
@maxcnunes
maxcnunes / fix_import_error_no_module_named_psycopg2.sh
Created August 6, 2013 16:11
How to fix the error: "ImportError: No module named psycopg2"
sudo apt-get build-dep python-psycopg2
pip install psycopg2
@maxcnunes
maxcnunes / running-locally-rails-server-production.sh
Created August 18, 2013 22:35
How to run rails server locally as production environment
rake db:migrate RAILS_ENV="production"
rails s -e production
(since_became_a_zombie..Float::INFINITY).each { eat :brains, :tasks }
@maxcnunes
maxcnunes / .gitignore
Created September 25, 2013 20:03
Git keep empty folder: 1. Add a .gitkeep file inside the folder you want to keep 2. Then include this configuration in your .gitignore
path_your_folder/*
!path_your_folder/.gitkeep
@maxcnunes
maxcnunes / clear_file.sh
Created October 24, 2013 11:50
Clear the contents of an existing UNIX file
sudo cp /dev/null my_file.txt
#yank inner word
yiw
#visually select inner word
viw
mkdir tdd && cd tdd

bundle init

vim Gemfile
# A sample Gemfile
@maxcnunes
maxcnunes / Ask_Version.cs
Last active December 31, 2015 15:19
Example of Principle Tell don't Ask
private class Screen
{
Form mainForm = ...
private void Screen_Loaded(object sender, ControlLoadedEventArgs e)
{
if(mainForm.InputControls != null && mainForm.InputControls.Contains("Id"))
mainForm.InputControls["Id"].Editable = isEditable;
}
}
@maxcnunes
maxcnunes / example.js
Created December 24, 2013 12:55
Wait mongo connection before test express controller/route with supertest
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){