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
<center id="timer-container"> | |
<div id="times-up"> | |
<div id="its-time">It's time!</div> | |
<div id="its-okay">(it's okay)</div> | |
</div> | |
<div id="timer"> | |
<div id="days"></div> | |
<div id="hours"></div> | |
<div id="minutes"></div> | |
<div id="seconds"></div> |
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
# This crontab is automatically generated on deploy | |
SHELL=/bin/bash | |
MAILTO=errors@example.com | |
RAILS_ENV=<%= stage %> | |
RAKE_CMD="<%= "#{bundle_path} rake --rakefile #{current_path}/Rakefile --trace" %>" | |
LOG_FILE="<%= "#{current_path}/log/cron.log" %>" | |
# Note: times are in the user's local time | |
<% if stage == :production && primary_server -%> |
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
-- Check the total size of each database | |
SELECT | |
tables.TABLE_SCHEMA AS database_name, | |
ROUND(SUM(tables.DATA_LENGTH + tables.INDEX_LENGTH) / POWER(2, 30), 3) AS database_size_in_gb | |
FROM information_schema.TABLES AS tables | |
GROUP BY tables.TABLE_SCHEMA | |
ORDER BY database_size_in_gb DESC; | |
-- List all tables larger than 1 GB | |
SELECT |
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
// ==UserScript== | |
// @name Pivotal Tracker Info Radiator | |
// @namespace http://kampers.net | |
// @include https://www.pivotaltracker.com/projects/* | |
// ==/UserScript== | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } |
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
# The I18n gem included in Rails 2.3.10 deprecates the {{key}} interpolation | |
# syntax in favor of %{key}, but Remarkable still uses the deprecated syntax. | |
# This is fixed in https://github.com/remarkable/remarkable/commit/23177b7ddd, | |
# but not yet released in a gem that's still compatible with Rails 2 and RSpec 1.3. | |
change_string_values_to_new_syntax = lambda do |key, value| | |
case value | |
when String then value.gsub!(I18n::Backend::Base::DEPRECATED_INTERPOLATION_SYNTAX_PATTERN, '%{\2}') | |
when Hash then value.each_pair(&change_string_values_to_new_syntax) | |
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
# Git doesn't remove submodules from your working tree when you pull. This Rails | |
# initializer will take care of it for you, so developers don't have to do | |
# anything. | |
paths = %w(vendor/gems/first_gem-1.0.0 | |
vendor/gems/another_gem-1.0.0) | |
paths.each do |path| | |
dir = Rails.root.join(path) | |
if File.directory?(dir) |
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
# config/initializers/cucumber_fakeweb_hook.rb | |
# If this looks like a test server process, make its FakeWeb available to other | |
# processes via DRb. That way the test runner (which runs in a separate process) | |
# can dynamically register stubs for this server to use. | |
if Rails.env.cucumber? && defined?(PhusionPassenger) | |
require 'drb' | |
require 'fakeweb' | |
DRb.start_service("druby://localhost:30010", FakeWeb) |
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
# Check an email address domain's validity using MX records | |
require 'resolv' | |
def known_email_domain?(email) | |
domain = email.match(/\@(.+)/)[1] | |
Resolv::DNS.open { |dns| dns.getresources(domain, Resolv::DNS::Resource::IN::MX) }.any? | |
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 | |
# This script uses Pivotal Tracker's API to generate a list of unique members | |
# from all of your projects; it then iterates over each project, adding any of | |
# those members who are missing. That way, everyone has access to everything. | |
# | |
# It only acts on projects belonging to accounts called ACCOUNT_NAME below. | |
# | |
# By default, the script doesn't proceed with the modifications, so you can | |
# double-check the pending changes. Run it again with --no-dry-run to proceed. |
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
# Originally by Nicholas A. Evans. See LICENSE.txt | |
# | |
# Note: includes modifications by Chris Kampmeier to use '=' for the progress | |
# bar mark and keep the cursor from hopping all around during the animation | |
# | |
# This version is compatible with RSpec 1.2.9 and ProgressBar 0.9.0 | |
require 'spec/runner/formatter/base_text_formatter' | |
require 'progressbar' |
NewerOlder