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
/** | |
* @author Freddie Mercury | |
* @copyright Sony/ATV Music Publishing LLC | |
*/ | |
let BohemianRhapsody = function(){ | |
// Is this the real life? | |
// Is this just fantasy? | |
try { |
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
# Migrate schema and data from Mongoid to MySQL ActiveRecord | |
class MongoidMysqlMigrator | |
def randomize_auto_increment_values(source_models, from=5500, to=10500) | |
source_models.each do |model| | |
value = rand(from-to)+from | |
sql = %(ALTER TABLE #{model.name.tableize} AUTO_INCREMENT=#{value}) | |
puts sql | |
ActiveRecord::Base.connection.execute(sql) | |
end |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'twitter' | |
require 'json' | |
require 'faraday' | |
# things you must configure | |
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder | |
TWITTER_USER = "your_twitter_username" |
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
class Admin::DelayedJobsController < AdminController | |
# GET /admin/delayed_jobs | |
def index | |
@delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:created_at) | |
.paginate :page => params[:page], :per_page => 20 | |
end | |
end |
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
# system-specific logs may be also be configured here. | |
/home/*/logs/*_log /home/*/domains/*/logs/*_log { | |
rotate 5 | |
weekly | |
compress | |
postrotate | |
cp /dev/null /path/to/where/the/apache/log/file/lives | |
cp /dev/null /path/to/where/the/other/files/is | |
cp /dev/null /path/to/where/the/other/files/is/etc/etc | |
endscript |
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
class Date | |
def to_words | |
if self == Date.today | |
"Today" | |
elsif self <= Date.today - 1 | |
if self == Date.today - 1 | |
"Yesterday" | |
elsif ((Date.today - 7)..(Date.today - 1)).include?(self) | |
"Last #{self.strftime("%A")}" | |
elsif ((Date.today - 14)..(Date.today - 8)).include?(self) |