Skip to content

Instantly share code, notes, and snippets.

View huoxito's full-sized avatar
🏊‍♂️

Washington L Braga Jr huoxito

🏊‍♂️
View GitHub Profile
@petergerard
petergerard / watermark.rb
Created February 25, 2011 05:50
paperclip_processor for watermarking that works with rails 3 and paperclip 2.3.8
# from http://github.com/ng/paperclip-watermarking-app
# with modifications from http://exviva.posterous.com/watermarking-images-with-rails-3-and-papercli
# and even more modifications to ensure works with paperclip 2.3.8 and rails 3.0.3
#
# Note: In rails 3 paperclip processors are not automatically loaded.
# You must add the following above your model class definition:
#
# require 'paperclip_processors/watermark'
module Paperclip
@huoxito
huoxito / vimrc
Created August 1, 2011 19:52
Vimrc file
" Plugin: pathogen.vim: manage your runtimepath
call pathogen#infect()
filetype plugin indent on
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
set incsearch " Incremental search
@klauswuestefeld
klauswuestefeld / gist:1595701
Created January 11, 2012 17:22
O Ciclo Vicioso Do Software Retranqueiro
We couldn’t find that file to show.
@jrbasso
jrbasso / pre-commit
Created March 31, 2012 21:54
Pre commit hook for CakePHP
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
echo "Checking PHP Lint..."
FILES=""
for FILE in `git diff --cached --name-only --diff-filter=ACMR HEAD | egrep \\\\.\(php\|ctp\)\$`
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]
@infoslack
infoslack / bkp-mysql.sh
Created June 29, 2012 21:00
Backup Mysql Shell Script
#!/bin/bash
DATA=`date +%Y%m%d-%H%M`
DUMP=/usr/bin/mysqldump
MYSQLDIR='cd /tmp/bkp'
TAR=/bin/tar
$DUMP -uroot -p123 --all-databases > /tmp/bkp/mysql.bkp_$DATA
$MYSQLDIR
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 24, 2024 15:28
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@filipechagas
filipechagas / gist:5398243
Created April 16, 2013 18:20
tmux powerline style status bar
set -g status-left-length 32
set -g status-right-length 150
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
@huoxito
huoxito / spree_backend_install.md
Last active March 25, 2020 03:35
Spree backend install

Set up a Spree backend only install

rails new store-backend

Gemfile

gem 'spree_backend', github: 'spree/spree'
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@javan
javan / application_controller.rb
Created November 30, 2013 22:06
Prevent cross-origin js requests
class ApplicationController < ActionController::Base
before_filter :ensure_xhr
private
def ensure_xhr
if request.get? && request.format && (request.format.js? || request.format.json?)
head :forbidden unless request.xhr?
end
end
end