Skip to content

Instantly share code, notes, and snippets.

View thiago-vieira's full-sized avatar
🏴

Thiago Vieira thiago-vieira

🏴
View GitHub Profile
<style>
a.negrito { font-weight: bold; }
input.fundo_verde { background-color: #8CDFAD}
</style>
<script>
$(document).ready(function(){
$("input").focus(function(){
$(this).addClass("fundo_verde");
});
@thiago-vieira
thiago-vieira / application.html.erb
Created June 29, 2011 12:51
jQuery with Prototype
<!-- with gem "jquery-rails" -->
<%= javascript_include_tag :defaults %>
<script>jQuery.noConflict();</script>
<%= javascript_include_tag 'prototype' %>
@thiago-vieira
thiago-vieira / .nanorc
Created May 9, 2012 14:26
Nano Editor configuration
# ~/.nanorc
set const
set tabsize 2
@thiago-vieira
thiago-vieira / nginx
Created May 9, 2012 19:53
Nginx start stop restart
#!/bin/sh
#
# Copy of /etc/init.d/nginx for Fedora/RedHat/CentOS
#
# CAUTION: modified for use nginx="/opt/nginx/sbin/nginx" and NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
@thiago-vieira
thiago-vieira / nginx_passenger
Created May 13, 2012 01:07
Nginx + Passenger on Ubuntu 11.04
# Download and add repository key
wget http://apt.brightbox.net/release.asc -O - | sudo apt-key add -
# Add this line on /etc/apt/source.list
deb http://apt.brightbox.net hardy main
sudo apt-get update
sudo apt-get install nginx-brightbox
@thiago-vieira
thiago-vieira / nginx
Created May 13, 2012 02:32
Nginx start stop restart made by BrightBox Ubuntu 11.04
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@thiago-vieira
thiago-vieira / delete_data_models.rb
Created May 14, 2012 13:25
Deleting all records of all models
Dir["app/models/*.rb"].each do |file|
model = file.gsub("app/models/", "").gsub(".rb", "")
"#{model.camelize}".constantize.unscoped.delete_all rescue nil
end
@thiago-vieira
thiago-vieira / tilda.desktop
Created May 14, 2012 13:25
Desktop Entry on Ubuntu
# Add on /usr/share/applications
[Desktop Entry]
Name=Tilda
Exec=tilda
Icon=tilda.png
Terminal=false
Type=Application
Categories=GTK;Utility;TerminalEmulator
{
"color_scheme": "Packages/Color Scheme - Default/Mac Classic.tmTheme",
"font_size": 12,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"word_wrap": "true",
"wrap_width": 80
}
@thiago-vieira
thiago-vieira / python.py
Created November 23, 2012 20:18
del objects in python
class Class:
def __init__(self):
self.attribute = "value"
instance = Class()
print(instance.attribute) # "value"
del instance.attribute
print(instance.attribute) # ops, AttributeError
del Class
new_instance = Class() # ops, NameError