This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monkey patch devise token authenticable to have tokens surviving in cookies | |
require 'securerandom' | |
module Devise | |
module Models | |
module TokenAuthenticatable | |
module ClassMethods | |
# Generate a token checking if one does not already exist in the database. | |
def authentication_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM tbl1 INFO OUTFILE '/tmp/tbl1.txt'; | |
LOAD DATA INFILE '/tmp/tbl1.txt' INTO TABLE tbl2; | |
//see http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://www.mysqlperformanceblog.com/2008/03/17/researching-your-mysql-table-sizes/ | |
SELECT count(*) tables, | |
-> concat(round(sum(table_rows)/1000000,2),'M') rows, | |
-> concat(round(sum(data_length)/(1024*1024*1024),2),'G') data, | |
-> concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx, | |
-> concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size, | |
-> round(sum(index_length)/sum(data_length),2) idxfrac | |
-> FROM information_schema.TABLES | |
-> WHERE table_name like "foo"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# LICENSE | |
# | |
# The MIT License | |
# | |
# Copyright (c) 2011 Samuel Oey, Ubilabs GmbH (oey@ubilabs.net) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Change this: | |
ActionController::Base.class_eval do | |
def perform_action | |
perform_action_without_rescue | |
end | |
end | |
#to: |