⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains hidden or 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 | |
yearweek(field, 1) | |
from | |
table; |
This file contains hidden or 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
# Runs a specified shell command in a separate thread. | |
# If it exceeds the given timeout in seconds, kills it. | |
# Returns any output produced by the command (stdout or stderr) as a String. | |
# Uses Kernel.select to wait up to the tick length (in seconds) between | |
# checks on the command's status | |
# | |
# If you've got a cleaner way of doing this, I'd be interested to see it. | |
# If you think you can do it with Ruby's Timeout module, think again. | |
def run_with_timeout(command, timeout, tick) | |
output = '' |
This file contains hidden or 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
# TO_FOLDER=/something | |
# FROM=/your-es-installation | |
DATE=`date +%Y-%m-%d_%H-%M` | |
TO=$TO_FOLDER/$DATE/ | |
echo "rsync from $FROM to $TO" | |
# the first times rsync can take a bit long - do not disable flusing | |
rsync -a $FROM $TO | |
# now disable flushing and do one manual flushing |
This file contains hidden or 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 'cell/base' | |
class FakeRoutes # should be sinatra's url helper instance | |
def url_for(*) | |
end | |
def named_routes # required due to a fucking stupid line in AbstractController::UrlFor#25 (3.2.3) | |
# super - _routes.named_routes.helper_names | |
Object.new.instance_eval do |
This file contains hidden or 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
[".e4ward.com", | |
".mailexpire.com", | |
".otherinbox.com", | |
"0815.ru", | |
"0clickemail.com", | |
"0wnd.net", | |
"0wnd.org", | |
"10minutemail.com", | |
"20minutemail.com", | |
"2prong.com", |
This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:
- Hulu / HuluPlus
- CBS
- ABC
- MTV
- theWB
- CW TV
- Crackle
- NBC
This file contains hidden or 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
# # # # # scheduled_job.rb - recurring schedules for delayed_job.rb # # # # # | |
# | |
# This file is version controlled at https://gist.github.com/ginjo/3688965 | |
# | |
# Forked from https://gist.github.com/kares/1024726 | |
# | |
# This is an enhanced version of the original scheduled_job.rb | |
# It was born out of the need to schedule a whole bunch of simple jobs. | |
# I started with the sample below and quickly found that I was repeating | |
# a lot of code. So I created the Delayed::Task pseudo-class that allows |
OlderNewer