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
<form id="create_form" class="one-third column alpha" data-bind="submit: createNewLink"> | |
<!-- ko with: newLink --> | |
<p> | |
<label for="link_url">Link:</label> | |
<input type="text" name="link[url]" id="link_url" data-bind="value: url"/> | |
</p> | |
<p> | |
<label for="description">Description:</label> | |
<input type="text" name="link[description]" id="link_description" data-bind="value: description"/> | |
</p> |
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
this.allLinks = ko.observableArray(); | |
this.lickedLinks = ko.computed(function() { | |
return this.allLinks().filter(function(link) { | |
return link.isLicked(); | |
}); | |
}, this); | |
this.newLinks = ko.computed(function() { | |
return this.allLinks().filter(function(link) { |
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
ko.bindingHandlers.hidden = { | |
update: function(element, valueAccessor){ | |
var value = ko.utils.unwrapObservable(valueAccessor()); | |
ko.bindingHandlers.visible.update(element, function() { | |
return !value; | |
}); | |
} | |
}; |
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
$(function(){ | |
App.globalApp = new App(); | |
ko.applyBindings(App.globalApp); | |
App.globalApp.loadLinks(); | |
}); |
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 'gosu' | |
require 'texplay' | |
class GameWindow < Gosu::Window | |
def initialize | |
super 200, 200, false | |
self.caption = "Scratch-off Sample" | |
# below we set up the image resources that we'll use for the app | |
# your base image that will be hidden under the grey layer | |
@background_image = Gosu::Image.new(self, "a.jpg", true) | |
# simply grey to cover our first image |
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
get '/hi' do | |
"Hello World!" | |
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
get "/test_page" do | |
markdown :test_file, :layout_engine => :erb | |
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
def insert_big_arsed_table(array_of_values, created_date) | |
sql = "COPY big_arsed_table (other_table_id, other_id, other_type, created_at, updated_at) from STDIN WITH DELIMITER AS ',' " | |
ActiveRecord::Base.connection_pool.with_connection do |conn| | |
rc = conn.raw_connection | |
begin | |
rc.exec(sql) | |
loop_time = Benchmark.ms do |
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
$ bin/mruby -e "puts 'hello world'" | |
hello world |
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
$ which ruby | |
/Users/schneems/.rvm/rubies/ruby-1.9.3-p194/bin/ruby |