Skip to content

Instantly share code, notes, and snippets.

View daltonjorge's full-sized avatar

Dalton Jorge daltonjorge

  • UFCG
  • Brazil - Paraiba - Campina Grande
View GitHub Profile
@daltonjorge
daltonjorge / rails_annotations.md
Created August 8, 2012 14:42 — forked from hakagura/rails_annotations.md
Explicações de conceitos do Rails e outras infos úteis.

Active Record

É um design pattern que o Rails implementa a partir da gem ActiveRecord.

Serve para conectar a camada Model da aplicação com tabelas do database, para assim criar um modelo de domínio persistível, onde a lógica (Model) e dados (BD) são apresentados em uma única solução.

Já persiste no BD:

obj.create
@daltonjorge
daltonjorge / Preferences.sublime-settings
Created November 22, 2012 01:57
My Preferences.sublime-settings
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
"tab_size": 2,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,
"remember_open_files": false,
"vintage_start_in_command_mode": true,
"ignored_packages": [""],
{
"cmd": ["groovy","$file"],
"windows":
{
"shell": "cmd.exe"
}
}
export JRUBY_OPTS=--1.8
export PS1='\n\[\033[38m\]\u\[\033[32m\] \w \[\033[1;33m\]`~/.rvm/bin/rvm-prompt i v g
`\[\033[0;31m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /
`\[\033[37m\]\n$\[\033[00m\] '
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "⚡"
}
@daltonjorge
daltonjorge / cookies.js
Created August 8, 2013 15:02
Reading and writing Cookies
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
@daltonjorge
daltonjorge / .tmux.conf
Created September 5, 2013 02:12
My tmux config file.
set-option -g default-shell /bin/zsh
# An informative prompt that gives you hg and git repository info,
# as well as return code, RVM/rubenv info, and standard hostname, path, user.
# by Avery Yen <haplesshero13@gmail.com>
#
# Hosted at <https://github.com/haplesshero13/my-tools>
#
# Requires hg-prompt <http://stevelosh.com/projects/hg-prompt/>
#
# Stolen mostly from <http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/>
# and alanpeabody.zsh-theme from Oh-My-Zsh.
# Shows little symbol '±' if you're currently at a git repo and '○' all other times
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
echo '○'
}
PROMPT='
%{$fg[blue]%}%n%{$reset_color%} on %{$fg[yellow]%}%m%{$reset_color%} in %{$fg[green]%}%~%b%{$reset_color%} $(hg_prompt_info)$(git_time_since_commit)$(check_git_prompt_info)
${vcs_info_msg_0_}$(prompt_char) '
@daltonjorge
daltonjorge / .zshrc
Last active December 25, 2015 05:28
My ZSH config file.
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
# ZSH_THEME="rkj-repos"
ZSH_THEME="zanshin"
@daltonjorge
daltonjorge / close_connections_database
Created November 1, 2013 14:47
Drop all connections to a specific postgresql database.
select pg_terminate_backend(procpid) from pg_stat_activity where datname='db';