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
<% @searchresults.each do |movie| %> | |
Found: <%= movie.name %> | <%= movie.id %><br /> | |
<% 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
content_for :js do | |
<!-- Output the base view-model code for our User resource. The view-model | |
will by default have client-side validations that mimic the server-side | |
model validations. It will also only expose interface methods for | |
attributes that are marked as accessible on the server-model | |
--> | |
<%= User.generate_view_model :update => :onchange %> | |
end | |
<!-- Now create the HTML elements that are bound to our view-model --> |
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
framework 'cocoa' | |
class Application | |
def applicationDidFinishLaunching(notification) | |
frame = NSRect.new(NSPoint.new(100, 100), NSSize.new(300, 300)) | |
@main_window = NSWindow.alloc.initWithContentRect( | |
frame, | |
:styleMask => (NSTitledWindowMask | NSClosableWindowMask), | |
:backing => NSBackingStoreBuffered, |
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
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable @__instance__ not initialized | |
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable @inheritable_attributes not initialized | |
unknown: warning: instance variable __attached__ not initialized | |
unknown: warning: instance variable __attached__ not initialized | |
unknown: warning: instance variable __attached__ not initialized |
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 'benchmark' | |
require 'sexpistol' | |
require 'sxp' | |
class Lexer | |
def initialize(str) | |
@str = str | |
@p = 0 | |
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
require 'benchmark' | |
require 'sexpistol' | |
require 'sxp' | |
class Lexer | |
def initialize(str) | |
@str = str | |
@p = 0 | |
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
require 'benchmark' | |
require 'sexpistol' | |
require 'sxp' | |
example_sexp = <<-EOD | |
((display "This is a test string!") | |
(define test (lambda () (begin | |
(display (== 1 1)) |
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
def extract_string_literals( string ) | |
string_literal_pattern = /"([^"\\]|\\.)*"/ | |
string_replacement_token = "___+++STRING_LITERAL+++___" | |
# Find and extract all the string literals | |
string_literals = [] | |
string.gsub(string_literal_pattern) {|x| string_literals << x} | |
# Replace all the string literals with our special placeholder token | |
string = string.gsub(string_literal_pattern, string_replacement_token) | |
# Return the modified string and the array of string literals | |
return [string, string_literals] |
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
# Benchmark this system's performance from a developer's perspective. | |
# | |
# * Configure and compile Ruby | |
# * Run the test suite of several medium sized Ruby applications | |
# * Run the database-heavy test-suite of a Rails application | |
# * Test the launch times of several common applications | |
class DeveloperBenchmark | |
require 'fileutils' |
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
run_lexer("test = -100") | |
#=> [{:value=>"test", :name=>:identifier}, {:value=>"=", :name=>:assignment_operator}, {:value=>"-100", :name=>:integer_literal}] |