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
#!/bin/bash | |
# chkconfig: 2345 98 02 | |
# description: Starts and stops Solr production | |
# Calculate RAILS_ROOT as 2 directories above the current file | |
_script_name=`basename $0` | |
RAILS_ROOT=`pwd`/`echo $0 | sed -e s/$_script_name//`.. | |
RAILS_ENV=$2 | |
set -e |
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
WARNING: enabling "trust" authentication for local connections | |
You can change this by editing pg_hba.conf or using the -A option the | |
next time you run initdb. | |
Success. You can now start the database server using: | |
/usr/local/bin/postgres -D /usr/local/var/postgres | |
or | |
/usr/local/bin/pg_ctl -D /usr/local/var/postgres -l logfile start |
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 DirtyTrackingArray < Array | |
attr_accessor :dirty | |
def initialize | |
@dirty = false | |
end | |
def push(value) | |
@dirty = true | |
super |
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
(function($){ | |
$.fn.sticky = function () { | |
var toolbar = $(this); | |
var wrapper = $(this).wrap($('<div />', { id : toolbar.attr('id') + '-wrapper'})).parent(); | |
$(this).width(wrapper.width()); | |
wrapper.height($(this).outerHeight()); | |
$(window).bind('scroll resize', function () { | |
toolbar.toggleClass('follow', !$.fn.sticky.isScrolledIntoView(wrapper)); | |
}); |
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 prints the caller of a method. Useful to see who the hell called a function that shan't be called: | |
console.debug(arguments.callee.caller.toString()); |
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
# List of environments and their heroku git remotes | |
ENVIRONMENTS = { | |
:staging => 'myapp-staging', | |
:production => 'myapp-production' | |
} | |
namespace :deploy do | |
ENVIRONMENTS.keys.each do |env| | |
desc "Deploy to #{env}" | |
task env do |
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 BundleHelper | |
def javascript_dev(*sources) | |
output = "" | |
sources = sources.to_a | |
sources.each do |pair| | |
output << javascript_src_tag(Rails.env.development? ? "dev/#{pair[0]}" : pair[1], {}) | |
end | |
output.html_safe | |
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
>> redis = Redis.new | |
=> #<Redis client v2.0.3 connected to redis://127.0.0.1:6379/0 (Redis v1.2.6)> | |
>> redis.smembers('missing') | |
=> nil | |
>> redis.sadd('missing', 'hello') | |
=> true | |
>> redis.smembers('missing') | |
=> ["hello"] |
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
$column_width: 30; | |
$gutter_width: 10; | |
@mixin container($columns) { | |
margin-left: auto; | |
margin-right: auto; | |
width: #{($columns * ($column_width + $gutter_width))}px; | |
} | |
@mixin alpha-column { |
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
// Pass a function to profile and optionally the number of times to run | |
function profile(test, times) { | |
var start = new Date().getTime(); | |
if (times === undefined) { | |
times = 100; | |
} | |
for (i = 0; i < times; ++i) { | |
test(); | |
}; |
OlderNewer