In my fast Gem, in lib/fast/fast.rb:
If I write
module Fast
def self.dir path = nil
Fast::Dir.new( path ).list if path
Fast::Dir.new
end
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_ | |
=> true |
require "json" | |
require "psych" | |
module Fast | |
class File | |
def append path, content | |
::File.open path, "a" do |handler| | |
handler.write content | |
end | |
end |
$LOAD_PATH << File.expand_path( "lib" ) | |
require "piano/fast" | |
require "piano/rest" | |
disable :etags | |
enable :sessions | |
post "/" do | |
resource :index | |
save_data params |
require "maruku" | |
class DCResource | |
attr_accessor :identifier, :title, :description | |
def initialize path | |
if File.exist? path | |
@identifier = path.force_encoding("UTF-8") | |
@title = path.force_encoding("UTF-8") | |
@description = File.read( path ).lines.to_a[0..4].join("\n").force_encoding("UTF-8") |
# Instructions | |
# ============ | |
# | |
# Put some files with no extension in /data and see the server | |
# read them (in stdout). | |
# | |
# > gem 'piano' | |
# > gem 'addressable' | |
# > gem 'mime-types' |
require "mechanize" | |
module Environment | |
def self.server | |
"http://localhost:4567/" | |
end | |
module Setup | |
def self.file donde, que | |
File.open donde, "w" do |file| |
In my fast Gem, in lib/fast/fast.rb:
If I write
module Fast
def self.dir path = nil
Fast::Dir.new( path ).list if path
Fast::Dir.new
end
@mixin hoverable($width, $height) | |
display: block | |
position: relative | |
overflow: hidden | |
height: $height | |
width: $width | |
img | |
position: relative | |
display: block | |
img.rollover |
!!! 5 | |
%html | |
%head | |
%body | |
- device.ipad? do | |
- Piano::Device.device.ipad? | |
- device.mobile? do | |
- device.not_mobile? do |
# This class has been implemented into a gem rebuilding SymbolTable from the ground. It's called "SymbolMatrix" | |
# http://github.com/Fetcher/symbolmatrix | |
# Stupid but really useful class: | |
# Inherits from SymbolTable (https://github.com/mjijackson/symboltable), but when it is initialized | |
# it simply... well, recursively converts all Hashes into dictionaries | |
class Dictionary < SymbolTable | |
def initialize *args | |
super *args |