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
set(:branch) do | |
if :production == stage | |
branch = Capistrano::CLI.ui.ask("#{`git branch`}\n\nWhich branch do you want to deploy?: ") | |
raise "Error: The master branch cannot be deployed to production." if 'master' == branch | |
else | |
`git branch | grep ^* | sed s/\\*\\ //`.chomp # use current active branch for staging | |
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
Entry.transaction do | |
Playlist.all.each do |playlist| | |
if positions_max = playlist.entries.maximum(:position) | |
ActiveRecord::Base.connection.execute(" | |
UPDATE entries SET position = #{positions_max + 1} - position | |
WHERE playlist_id = #{playlist.id}") | |
end | |
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
def schedule_event(event) | |
now = Time.now | |
# Determine the next occurrence starting at (Time.now - event.duration) to | |
# catch the current occurence where start_at <= Time.now but end_at > Time.now. | |
# | |
# When occurrence == nil, this means the event will never occur. | |
occurrence = event.occurrences(:starting => now - event.duration, :count => 1) | |
return if occurrence.nil? |
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
# | |
# Steps I took to re-sync my fork of rufus-scheduler to the | |
# new branches on jmettraux/rufus-scheduler after the following renames: | |
# | |
# master -> onezero | |
# twozero -> master | |
# | |
$ git clone [email protected]:kjwierenga/rufus-scheduler.git # fresh clone of my fork | |
$ cd rufus-scheduler |
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
# steps I took | |
$ git clone [email protected]:kjwierenga/rufus-scheduler.git | |
$ cd rufus-scheduler | |
$ git branch -a | |
* master | |
origin/HEAD | |
origin/master | |
origin/twozero | |
$ git remote add upstream git://github.com/jmettraux/rufus-scheduler.git |
NewerOlder