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
`which mysql` -u root -p INFORMATION_SCHEMA -e 'SELECT s.schema_name, | |
CONCAT(IFNULL(ROUND((SUM(t.data_length) | |
+SUM(t.index_length))/1024/1024,2),0.00),"Mb") total_size, | |
CONCAT(IFNULL(ROUND(((SUM(t.data_length)+SUM(t.index_length)) | |
-SUM(t.data_free))/1024/1024,2),0.00),"Mb") data_used, | |
CONCAT(IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00),"Mb") data_free, | |
IFNULL(ROUND((((SUM(t.data_length)+SUM(t.index_length)) | |
-SUM(t.data_free))/((SUM(t.data_length) | |
+SUM(t.index_length)))*100),2),0) pct_used, | |
COUNT(table_name) total_tables |
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
shitari(){ | |
defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO | |
defaults write com.apple.Safari DebugSafari4IncludeToolbarRedesign -bool NO | |
defaults write com.apple.Safari DebugSafari4LoadProgressStyle -bool NO | |
echo 'Fixed.' | |
} |
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
mm(){ | |
[ -f *.tmproj ] && open -a 'textmate' `ls -lG *.tmproj | awk '{print $9}'` || mate . | |
} |
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
alias desvn='find . -name ".svn" -exec rm -rf {} \;' |
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 'test_helper' | |
class SignupTest < ActionController::IntegrationTest | |
test "signing up" do | |
# Given there are X users | |
2.times { Factory(:user) } | |
users_count = User.count | |
# When I go to the signup page |
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
namespace :gems do | |
desc "Spit out gems.yml and .gems in root of app (for Heroku + EY etc.)" | |
task :specify => :environment do | |
gems = Rails.configuration.gems | |
# output gems.yml | |
yaml = File.join(RAILS_ROOT, "gems.yml") | |
File.open(yaml, "w") do |f| | |
output = [] | |
gems.each do |gem| |
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
# | |
# Add a :processing flag to our model | |
# | |
class AddProcessingToImages < ActiveRecord::Migration | |
def self.up | |
add_column :images, :processing, :boolean | |
end | |
def self.down |
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 joy of browser standards... seriously, IE8 - why? */ | |
.foo { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 8 */ | |
filter: alpha(opacity=50); /* IE 6 + 7 */ | |
-khtml-opacity: 0.50; /* Safari < 1.2 (KHTML) */ | |
-moz-opacity: 0.50; /* FF < 1.5, Mozilla <= 1.6 */ | |
opacity: 0.50; /* FF 1.5+, Safari 1.2+, Opera 9+ (CSS3) */ | |
} |
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
context "#domain" do | |
should "return correct domain from given host" do | |
examples = { | |
"foo.bar.mydomain.com" => "mydomain.com", | |
"foo.bar.www.mydomain.com" => "www.mydomain.com", | |
"foo.bar.www.mydomain.co.uk" => "www.mydomain.co.uk", | |
"www.mydomain.com" => "www.mydomain.com", | |
"foo.mydomain.co.uk" => "mydomain.co.uk", | |
"foo.bar.www.my-domain.com" => "www.my-domain.com", | |
"foo.m.net" => "m.net", |
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 bash | |
# | |
# install all of http://github.com/phuibonhoa's TM bundles (OS X only) | |
# | |
echo "Installing bundles..." | |
# backup dir | |
if [ -d ~/desktop/_tm_bundle_backups ]; then rm -rf ~/desktop/_tm_bundle_backups; fi |
OlderNewer