Skip to content

Instantly share code, notes, and snippets.

@Traz
Traz / user.rb
Last active December 15, 2015 22:49
User model with sorcery
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username, :null => false
t.string :lastname
t.string :identity
t.string :email, :default => nil
t.date :birthdate
@Traz
Traz / transfert.sh
Created April 8, 2013 01:49
A small working dirty script for use a git branch for a static site in Github pages, generated locally by a Jekyll server in an another git branch. Look at http://traz.github.io/posts/Jekyll-github/
#!/bin/bash
echo "------- Transfer statics pages to Github (make sure jekyll build ok, and git branch dev commited) ---"
current_branch=$(git branch | grep '*' | cut -c 3-)
echo -e "-- \033[1;33mGit\033[0m : Current branch :\033[0;31m $current_branch\033[0m"
if [ $current_branch != "dev" ]; then
echo -e "-- \033[0;31mERROR : Branch must be dev \033[0m"
@Traz
Traz / gist:5279557
Last active December 15, 2015 15:09
Some attempt to build a nice PRY set up file :) .pryrc
Pry.config.auto_indent = true
Pry.config.color = true
Pry.config.editor = "vim"
#Pry.config.prompt = Pry::DEFAULT_PROMPT
Pry.config.history.file = "~/pry_history"
Pry.config.hooks.add_hook(:before_session, :say_hi_lazza) do
puts "\n\nHi Traz !\nRuby#{RUBY_VERSION}\n\n"
end
Pry.config.hooks.add_hook(:after_session, :say_bye_lazza) do
puts "\n\nbye-bye Traz !\n\n"
@Traz
Traz / add_attachment_data_to_wrapper.rb
Created June 11, 2009 05:50
Small tips for building a polymorphic usage of Paperclip, with video to flv, video thumbnail, mp3 tag extraction, zip file listing processors.
class AddAttachmentsDataToWrapper < ActiveRecord::Migration
def self.up
add_column :wrappers, :data_file_name, :string
add_column :wrappers, :data_content_type, :string
add_column :wrappers, :data_file_size, :integer
add_column :wrappers, :data_updated_at, :datetime
end
def self.down
remove_column :wrappers, :data_file_name