We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
# Add these two gems | |
gem 'ice_cube', '0.9.3' | |
gem 'squeel', '1.0.16' |
module Base62 | |
BASE_CHARS = '0SKVnQFHhGs9qo7p8cRW54duMYNXTCErx2tDmwO3kabfUB1elLvjiIgyJAZ6Pz'.split('') | |
BASE = BASE_CHARS.length | |
BASE_ENCODED_MIN_LENGTH = 1 | |
def self.decode(number) | |
# assure string | |
number = number.to_s.reverse.split('') | |
decoded = 0 |
javascript:(function(){script = document.createElement("script");script.src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js";document.body.appendChild(script);})(); |
先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。
追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲:
after "deploy:stop", "clockwork:stop" | |
after "deploy:start", "clockwork:start" | |
after "deploy:restart", "clockwork:restart" | |
namespace :clockwork do | |
desc "Stop clockwork" | |
task :stop, :roles => clockwork_roles, :on_error => :continue, :on_no_matching_servers => :continue do | |
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && kill -INT `cat #{pid | |
_file}` ; fi" | |
end |
# The following should prevent an ArgumentError "invalid %-encoding (...%)" exception from being raised for malformed URLs. | |
# To use this code simply drop this in your rails app initializers. | |
# See: https://github.com/rack/rack/issues/337 | |
# Taken from: http://stackoverflow.com/a/11162317/1075006 | |
module URI | |
major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i } |
# Fix for a Rails - Ruby 1.9 bug | |
# Rails Router, now that it's UTF-8 default, blows up when routing requests | |
# with invalid chars in the URL; it should properly return a 400 error | |
# Have to monkey-patch the fix in, since it's not scheduled for release until | |
# Rails 4.0. | |
# Adapted Andrew White (pixeltrix)'s fix at | |
# https://github.com/rails/rails/commit/3fc561a1f71edf1c2bae695cafa03909d24a5ca3, | |
# but edited to work in 3.0.x. | |
# 3.1.x, 3.2.x compatibility unknown | |
require 'action_dispatch/routing/route_set' |
Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.
A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.
Create the repo:
by Jonathan Rochkind, http://bibwild.wordpress.com
Capistrano automates pushing out a new version of your application to a deployment location.
I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".