Skip to content

Instantly share code, notes, and snippets.

View joaofraga's full-sized avatar
:octocat:

João Fraga joaofraga

:octocat:
  • CEO @ Paag
  • Belo Horizonte, Brasil
View GitHub Profile
upstream samplewebsite {
server unix:/tmp/samplewebsite.com.socket fail_timeout=0;
}
server {
# enable one of the following if you're on Linux or FreeBSD
# listen 80 default deferred; # for Linux
# listen 80 default accept_filter=httpready; # for FreeBSD
@joaofraga
joaofraga / truncate_and_sanitize.rb
Created August 29, 2013 19:16
Remove all html entities and sanitize a string.
# Add this to Gemfile, then run 'bundle install'
gem "htmlentities"
# Add this to your helper
def truncate_and_sanitize(text, args={})
truncate sanitize(HTMLEntities.new.decode(text), tags: []), args
end
@joaofraga
joaofraga / deploy.rb
Created May 26, 2014 17:34
New server deploy configuration
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'samplewebsite.com'
# set :deploy_via, :copy
set :deploy_to, "/var/apps/#{fetch(:application)}"
set :checkout, "export"
# default_run_options[:pty] = true
set :use_sudo, false
@joaofraga
joaofraga / .bashrc
Last active August 29, 2015 14:02 — forked from justintv/.bashrc
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\] \[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ "
# gives me:
# jgfraga@ ~/development/ruby/project (master) # user in green, curr dir in yellow, and branch in green
@joaofraga
joaofraga / change_wp.sql
Created October 2, 2014 13:55
wordpress move url SQL
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com', 'http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
@joaofraga
joaofraga / readme.md
Created November 24, 2015 17:37
Bootable Windows USB from Mac OSX (Terminal)

How to create an Bootable Windows USB from OSX without Bootcamp

You will need

  • USB SSD with at least 8GB
  • Windows .ISO

With this on hands

Open terminal and do the following: