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
// Create a simple top to bottom linear gradient with a background-color backup | |
// The first argument, $color will be output as background-color: $color | |
// | |
// This yields a gradient that is 5% brighter on the top and 5% darker on the bottom | |
// | |
// +gradient-bg(#777) | |
// | |
// This yeilds a gradient where the bright and dark colors are shifted 10% from the original color. | |
// If you don't specify a third argument it will assign this value for the darkness too, keeping the gradient even. | |
// |
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
# | |
# Wind Wordpress Importer | |
# | |
# To install this plugin do you need copy the file to Wind plugins directory. | |
# An admin widget will be crated to import WordPress eXtended RSS file. | |
# | |
# This plugin use hurricane gem [http://github.com/danieltamiosso/hurricane], | |
# [gem install hurricane] to install it. | |
# |
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
mkdir wpgskeeter | |
cd wpgskeeter | |
git init | |
heroku create wpgskeeter | |
git add . | |
git commit -m 'Initial commit' | |
Create a .gems file: | |
sinatra | |
nokogiri |
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
lsoave@ubuntu:~/rails/tests/mongoid-rails3-devis-template$ rails s -e production | |
=> Booting WEBrick | |
=> Rails 3.0.3 application starting in production on http://0.0.0.0:3000 | |
=> Call with -d to detach | |
=> Ctrl-C to shutdown server | |
Exiting | |
/home/lsoave/.rvm/gems/ruby-1.8.7-p302/gems/mongo-1.1.2/lib/../lib/mongo/util/support.rb:58:in `validate_db_name': database name cannot be the empty string (Mongo::InvalidNSName) | |
from /home/lsoave/.rvm/gems/ruby-1.8.7-p302/gems/mongo-1.1.2/lib/../lib/mongo/db.rb:76:in `initialize' | |
from /home/lsoave/.rvm/gems/ruby-1.8.7-p302/gems/mongo-1.1.2/lib/../lib/mongo/connection.rb:312:in `new' | |
from /home/lsoave/.rvm/gems/ruby-1.8.7-p302/gems/mongo-1.1.2/lib/../lib/mongo/connection.rb:312:in `db' |
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 CanCan | |
class Query | |
def sanitize_sql(conditions) | |
conditions | |
end | |
end | |
# customize to handle Mongoid queries in ability definitions conditions | |
class CanDefinition | |
def matches_conditions_hash?(subject, conditions = @conditions) |
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
$ ab -c 1 -n 1000 http://127.0.0.1:3000/home | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Completed 100 requests | |
Completed 200 requests | |
Completed 300 requests | |
Completed 400 requests |
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
# ============================================================================ | |
# Info class | |
# ============================================================================ | |
class ApplicationInfo < Rails::Generators::AppGenerator | |
attr_reader :notices, :errors, :options, :data | |
def initialize | |
@notices = [] # Array of notices to display to the user at the end | |
@errors = [] # Array of errors to display to the user at the end | |
@options = [] # Array of options selected throughout the template |
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 'rubygems' | |
require 'sinatra' | |
set :public, Proc.new { File.join(root, "_site") } | |
# This before filter ensures that your pages are only ever served | |
# once (per deploy) by Sinatra, and then by Varnish after that | |
before do | |
response.headers['Cache-Control'] = 'public, max-age=31557600' # 1 year | |
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
# >---------------------------[ Install Command ]-----------------------------< | |
# rails new APP_NAME -m http://railswizard.org/257558554d274cfab160.rb -J | |
# >---------------------------------------------------------------------------< | |
# | |
# _____ _ _ __ ___ _ | |
# | __ \ (_) | \ \ / (_) | | | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| | | |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` | | |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| | | |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_| |