Skip to content

Instantly share code, notes, and snippets.

View joaodubas's full-sized avatar
🤓
always learning

Joao P Dubas joaodubas

🤓
always learning
View GitHub Profile
@joaodubas
joaodubas / LICENSE.txt
Created February 16, 2012 13:59
Render the content of a page using PhantomJS
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 João Paulo Dubas <http://aval.io>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@joaodubas
joaodubas / django.md
Created March 3, 2012 02:45
Steps to init django
  1. Instalar Xcode via AppleStore

  2. Instalar Command Line Tools for Xcode (procurar em Apple Developers)

  3. Instalar pip

    • sudo easy_install pip
  4. Instalar virtualenv e virtualenvwrapper

    • sudo pip install virtualenv virtualenvwrapper
  5. Alterar o arquivo .bash_profile, adicionando o código a seguir

     # Make pip respect virtualenv
    

export PIP_RESPECT_VIRTUALENV=true

@joaodubas
joaodubas / datamigration.py
Created March 30, 2012 21:57
Example of data migration for add/remove multi-table inheritance
class Migration(DataMigration):
def forwards(self, orm):
"""Based on solution:
http://stackoverflow.com/questions/4064808/django-model-inheritance-create-sub-instance-of-existing-instance-downcast
"""
parent_articles = orm['app.Parent'].objects.all()
for article in parent_articles:
children_article = orm['app.Children(parent_ptr=article)
children_article.__dict__.update(article.__dict__)
children_article.save()
@joaodubas
joaodubas / tmux.md
Created October 19, 2012 10:40 — forked from avelino/tmux.md
tmux cheat sheet

tmux - terminal multiplexer

Managing tmux sessions:

$ tmux      # start tmux server
$ tmux at   # attach running sessions to a terminal
$ tmux ls   # list running tmux sessions

Sharing sessions between terminals:

$ tmux new -s session_name # make new named session

$ tmux at -t session_name # attach to exist session (allowing shared sessions)

@joaodubas
joaodubas / LICENSE.txt
Last active December 10, 2015 23:08
# Desafio Se você pensar em um papel como um plano e uma letra como uma marcação neste plano, então estas letras dividem o plano em regiões. Por exemplo, as letras A, D e O dividem o plano em 2 pois possuem um espaço confinado em seu desenho, ou um “buraco”. Outras letras como B possuem 2 buracos e letras como C e E não possuem buracos. Portanto…
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 João Paulo Dubas <joao.dubas@gmail.com>
@joaodubas
joaodubas / .local_profile.sh
Created February 11, 2013 23:29
Extension to `.bash_rc`
# environment variables
bindir=$HOME/local/bin
if [[ ":$PATH:" != *":$bindir:"* ]]; then
PATH=$bindir:$PATH
export PATH
fi
# local development
export PROJECTS=$HOME/public
@joaodubas
joaodubas / .local_profile.sh
Last active December 12, 2015 10:19
Add node_modules to PATH environment variable.
# environment variables
bindir=$HOME/local/bin
if [[ ":$PATH:" != *":$bindir:"* ]]; then
PATH=$bindir:$PATH
export PATH
fi
# local development
export PROJECTS=$HOME/public
tbl = {
{
name='Very severely underweight',
upper=15
},
{
name='Severely underweight',
lower=15,
upper=16
},
@joaodubas
joaodubas / index.js
Last active December 19, 2015 11:59
Querying an array property in a collection with tingodb.
var fs = require('fs');
var path = require('path');
var engine = require('tingodb')({});
var dbPath = path.join(__dirname, 'db');
if (!fs.existsSync(dbPath)) {
fs.mkdirSync(dbPath);
}
@joaodubas
joaodubas / diagnose.css
Last active December 19, 2015 15:48
Take the idea from http://diagnosticss.github.io/ and add a warning message when hovering the element, so it became easier to understand what is the error.
/* inline styles */
[style] {
outline: 5px solid red;
}
[style]:hover::after {
content: "Inline style";
}
/* links */
a:not([href]), a[href=""] {