This file contains hidden or 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 ApiRepresenter | |
include Roar::Representer::JSON | |
property :name | |
end | |
module ApisRepresenter | |
include Representable::JSON::Collection | |
self.representation_wrap= :items |
This file contains hidden or 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
TEST'EM 'SCRIPTS! | |
Open the URL below in a browser to connect. | |
http://localhost:7357 | |
━━━━━━━━━━━━━━┓ | |
PhantomJS 1.5┃ Chrome 19.0 PhantomJS 1.5 | |
0/0 ◟ ┃ 0/0 ◞ 0/0 ◞ |
This file contains hidden or 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
watch('^app/assets/stylesheets/(.*\.scss)') { |m| WatchrValidation.check_sass(m[1]) } | |
class WatchrValidation | |
@@image_root = "~/Development/autotest_images" | |
def self.check_sass(sass_file) | |
result = system("clear; sass --check app/assets/stylesheets/#{sass_file}") | |
image = if result | |
"#{@@image_root}/pass.png" |
This file contains hidden or 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 SimpleBaseClass | |
def self.inherited(new_subclass) | |
puts "Hey #{new_subclass} is now a sublcass of #{self}!" | |
end | |
end | |
class SubClass < SimpleBaseClass | |
end |
This file contains hidden or 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 NoDoubleRaise | |
def raise(*args) | |
if $! && args.first != $! | |
warn "There is already one exception #{caller.first} raised" | |
exit! false | |
else | |
super | |
end | |
end | |
end |
This file contains hidden or 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 Fixnum | |
def is_dividable_by?(*numbers) | |
result = numbers.inject(0){|k,v| self%v if k == 0} | |
result == 0 ? true : false | |
end | |
end | |
output = {} | |
(1..100).each do |number| | |
output[number] = if number.is_dividable_by?(3,5); "ping pong" |
This file contains hidden or 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
=begin | |
shop2 = ShoppingCoupon.new(:name => 'Shop', :description =>"Clothes", | |
:items => [{:name => 'shirt', :price => 2.50}, {:name => 'pants', :price => 5}], | |
:purchased =>2011/03/21, :amount => 43.2) | |
shop2.save | |
=end | |
class ShoppingCoupon < CouchRest::Model::Base | |
use_database CouchServer.default_database |
This file contains hidden or 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
=begin | |
shop = ShoppingCoupon.new(:name => 'Shop', :description =>"Clothes", | |
:items => [{:name => 'shirt', :price => 2.50}, {:name => 'pants', :price => 5}], | |
:purchased =>2011/03/21, :amount => 43.2) | |
shop.save | |
=end | |
class Items < Hash | |
include CouchRest::Model::CastedModel |
This file contains hidden or 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
$ less ./licenses/LA_en | |
$ sudo mkdir -p /tmp/mq_license/license/ | |
$ sudo touch /tmp/mq_license/license/status.dat | |
$ sudo rpm -iavh --nodeps --force-debian ./MQSeriesRuntime-7.0.1-3.i386.rpm | |
Preparing... ########################################### [100%] | |
1:MQSeriesRuntime ########################################### [100%] | |
$ sudo mkdir -p /tmp/mq_license/license/ | |
$ sudo touch /tmp/mq_license/license/status.dat | |
$ sudo rpm -iavh --nodeps --force-debian ./MQSeriesJava-7.0.1-3.i386.rpm ./MQSeriesClient-7.0.1-3.i386.rpm ./MQSeriesServer-7.0.1-3.i386.rpm ./MQSeriesSDK-7.0.1-3.i386.rpm ./MQSeriesSamples-7.0.1-3.i386.rpm ./MQSeriesTXClient-7.0.1-3.i386.rpm | |
Preparing... ########################################### [100%] |
This file contains hidden or 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
set :application, "myapp" | |
set :ip_address , "000.000.000.000" | |
set :scm, :git | |
set :repository, "[email protected]:albertoleal/Sinatra-Template.git" | |
set :branch, "master" | |
set :deploy_via, :remote_cache | |
set :user , "sinatra" | |
set :deploy_to, "/home/sinatra/#{application}" |