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
| blahblah | |
| blah blah | |
| blah | |
| blah |
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
| 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} |
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
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| require 'rubygems' | |
| gem_dirs = [] | |
| basedir = 'deps' | |
| FileUtils.mkdir_p(basedir) | |
| ARGV.each do |gemset| |
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
| 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 ' |
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
| 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 |
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
| * 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. |
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
| (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")) |
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
| 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)") |
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
| Tpl.new("Testing loops: <% 3.times do %> * <% end %>") | |
| # => | |
| def self.render(__v = {}, __o = '') | |
| __o.concat("Testing loops: ") | |
| 3.times do | |
| __o.concat(" * ") | |
| end | |
| __o |
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
| # -*- 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 |