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
module Deletable | |
def self.included(base) | |
base.class_eval do | |
named_scope :are, :conditions => ['`deleted_at` IS NULL'] | |
named_scope :deleted, :conditions => ['`deleted_at` IS NOT NULL'] | |
named_scope :deleted_at, lambda {|timestamp| {:conditions => ['`deleted_at` = ?',timestamp.to_formatted_s(:db)]}} | |
def self.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
user app; | |
worker_processes 2; | |
error_log /home/app/logs/nginx.error.log info; | |
events { | |
worker_connections 1024; | |
} | |
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
# -------------------- Taking a peron name from E-mail header | |
# === Returns Hash with firstname, lastname, and email from String: | |
# | |
# String "John Smith < [email protected] >" will produce hash pairs: | |
# | |
# :firstname => "John", | |
# :lastname => "Smith", | |
# :email => "[email protected]" | |
# |
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
require "authlogic/test_case" | |
before(:each) do | |
activate_authlogic | |
UserSession.create Factory.build(:user) | |
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
# Original script is taken from http://www.omgubuntu.co.uk/2009/09/real-earth-wallpaper-linux.html | |
# It downloads World Sunlight Map every hour, and you could use it as wallpaper. | |
# I've added ImageMagick line to put your city on the map. Just change 'convert' parameters: | |
# '-size' - to set screen size | |
# '-annotate' - to set city name(two times) | |
# '-geometry' - to set your city position on the map | |
# Add to autostart and set your wallpaper to ~/world_sunlight_Wallpaper.jpg | |
# requires wget and ImageMagick | |
#!/bin/bash |
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 | |
@log_entries = Array.new | |
IO.foreach(ARGV[0]) do |line| | |
date,start_time,end_time,task,comments,duration = line.scan(/(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)/).flatten | |
@log_entries << "#{date.chomp}\t#{duration.chomp.gsub('.',',')}\t#{task.chomp}" | |
end | |
puts @log_entries[1..-2] |
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/ruby | |
# == SleepTill == | |
# | |
# Improved system 'sleep'. Could be used like: | |
# $ sleeptill 1 7 30 && mplayer -o loop superannoyingringer.mp3 =) | |
require 'rubygems' | |
require 'active_support' |
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/ruby | |
if ((ARGV[0] == nil) || (ARGV[0] == '--help')) | |
puts "Usage: rmultirename [PATTERN] [REPLACEMENT]" | |
printf "Example: rmultirename htm html \n\n" | |
exit | |
end | |
STDOUT.sync = true |
NewerOlder