Skip to content

Instantly share code, notes, and snippets.

blahblah
blah blah
blah
blah
task :watch_assets => [:compile_css, :compile_js] do |t, args|
timeout = ENV['WATCH_ASSETS_TIMEOUT'] || '0.2'
lockdir = './assets.lock'
cmd = <<-EOS
if mkdir #{lockdir} &>/dev/null; then
sleep #{timeout}
rake -s compile_css
rake -s compile_js
rmdir #{lockdir}
faust:tmp bruno$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
+ [[ -z '' ]]
+ rvm_path=/Users/bruno/.rvm
+ [[ 2 -gt 0 ]]
+ token=rvm_path
+ shift
+ case "$token" in
+ usage
+ printf '
erb_template = ERB.new(template_string) # Compiles template_string to ruby code that generates the output
erb_template.result # Slow, calls eval on the compiled string every time you call render
erb_proc = eval("Proc.new{#{erb_template.src}}")
erb_proc.call # Fast, calls the code directly, no eval involved when generating the output
* Modules have been added as a new program structure to improve
encapsulation and sharing of code. Some existing and new
identifiers have been factored out into separate modules.
* Exceptions can now be signalled explicitly with raise,
raise-continuable or error, and can be handled with
with-exception-handler and the guard syntax.
* New disjoint types supporting access to multiple fields can be
generated with define-record-type.
(defun tree-theme ()
(interactive)
(color-theme-install
'(tree-theme
((background-color . "#110C0B")
(foreground-color . "#FFFFFF")
(background-mode . dark)
(border-color . "#323232")
(cursor-color . "#FFFFFF")
(mouse-color . "#323232"))
require 'rubygems'
require "./nolate"
require "erb"
require "bench"
module FastERB
def self.new(*args)
o = Object.new
erb = ERB.new(*args)
o.extend erb.def_module("render(myfield)")
Tpl.new("Testing loops: <% 3.times do %> * <% end %>")
# =>
def self.render(__v = {}, __o = '')
__o.concat("Testing loops: ")
3.times do
__o.concat(" * ")
end
__o
# -*- coding: utf-8 -*-
module Tpl
def self.new_proc(template, variables = [])
render_definition = "Proc.new do |__v, __o|\n __v ||= {}; __o ||= ''\n"
compile(template, variables, render_definition)
render_definition << "__o\nend"
eval(render_definition)
end