Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
s = """Gur Mra bs Clguba, ol Gvz Crgref | |
Ornhgvshy vf orggre guna htyl. | |
Rkcyvpvg vf orggre guna vzcyvpvg. | |
Fvzcyr vf orggre guna pbzcyrk. | |
Syng vf orggre guna arfgrq. | |
Fcnefr vf orggre guna qrafr. | |
Ernqnovyvgl pbhagf. | |
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. | |
Nygubhtu cenpgvpnyvgl orngf chevgl. |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
require 'base64' | |
require 'RMagick' | |
include Magick | |
module Imager | |
class << self | |
def registered(app) | |
app.send :include, InstanceMethods | |
app.ready do |
x = 10000.times.to_a | |
a,b,c = x.dup, x.dup, x.dup | |
Benchmark.measure { 1000.times { out = []; out += a; out += b; out +=c; out.uniq! } } | |
Benchmark.measure { 1000.times { out = Set.new; out += a; out += b; out +=c; } } | |
Benchmark.measure { 1000.times { out = {}; a.each {|e| out[e] ||= 1}; b.each {|e| out[e] ||= 1}; c.each {|e| out[e] ||= 1}; } } |
# put in config/application.rb | |
config.to_prepare do | |
::PagesController.module_eval do | |
caches_page :show, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
caches_page :home, :unless => proc {|c| c.user_signed_in? || c.flash.any? } | |
end | |
::Page.module_eval do | |
after_save :clear_static_caching! | |
after_destroy :clear_static_caching! |
When starting a project that includes refinerycms-blog: | |
$ rake refinery:override view=refinery/pages/* | |
$ rake refinery:override view=layouts/* | |
$ rake refinery:override view=refinery/blog/shared/* | |
$ rake refinery:override view=refinery/blog/posts/* | |
$ rake refinery:override view=refinery/* | |
$ rake refinery:override controller=refinery/blog/* | |
$ rake refinery:override controller=refinery/* |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require "benchmark" | |
require 'map' | |
require 'digest/md5' | |
require 'hashr' | |
require 'hashie' | |
def keys( count, start = 'aaaaaa' ) |
require 'rubygems' | |
require 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db("test") | |
end | |
Mongoid.database.add_stored_function 'sequence', <<-__ | |
function(sequence) { |
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/gists/219223.txt | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |