This file contains 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 via: ruby -rubygems app.rb | |
require 'sinatra' | |
require 'haml' | |
disable :logging | |
get '/' do | |
title = "Drag'n'drop issue reduction" | |
haml :index | |
end |
This file contains 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
% curl -I https://admin:C0uchb4$3@db.insideguidance.com/cms -v | |
* About to connect() to db.insideguidance.com port 443 (#0) | |
* Trying 213.73.99.18... connected | |
* Connected to db.insideguidance.com (213.73.99.18) port 443 (#0) | |
* SSLv3, TLS handshake, Client hello (1): | |
* SSLv3, TLS handshake, Server hello (2): | |
* SSLv3, TLS handshake, CERT (11): | |
* SSLv3, TLS alert, Server hello (2): | |
* SSL certificate problem, verify that the CA cert is OK. Details: | |
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed |
This file contains 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
{ | |
"ok":true, | |
"no_changes":true, | |
"session_id":"191983e241fc72900cc9f27f14a98719", | |
"source_last_seq":99, | |
"replication_id_version":2, | |
"history": | |
[ | |
{ |
This file contains 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
Arrayobservers = SC.Application.create({ | |
NAMESPACE: 'Arrayobservers', | |
VERSION: '0.1.0', | |
store: SC.Store.create().from(SC.Record.fixtures) | |
}); |
This file contains 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
Arrayobservers = SC.Application.create({ | |
NAMESPACE: 'Arrayobservers', | |
VERSION: '0.1.0', | |
store: SC.Store.create().from(SC.Record.fixtures) | |
}); | |
Arrayobservers.objects = [SC.Object.create({foo: 1}), SC.Object.create({foo: 2})]; |
This file contains 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 each_fortune_value(initial_fortune, minimum_bet, maximum_bet) | |
table = PerfectEuropeanRouletteTable.new RouletteCroupier.new, minimum_bet, maximum_bet | |
player = MartingalPlayer.new initial_fortune, table | |
yield player.fortune | |
while not player.bankrupt? | |
player.place_jetons :black | |
table.croupier.no_more_bets | |
yield player.fortune | |
end |
This file contains 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
class RouletteCroupier | |
attr_accessor :table, :last_result | |
def bets | |
@bets ||= [] | |
end | |
def place_color_bet(player, color, amount) | |
bets << { :player => player, :color => color, :amount => amount } |
This file contains 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
hideOrShowDescriptionButton: SC.DisclosureView.design({ | |
tagName: 'div', | |
layout: { right: 80, top: 14, width: 15, height: 15 }, | |
isVisibleBinding: '*parentView.shouldAllowCollapsingStories', | |
didChangeValue: function() { | |
this.get('parentView').didHideOrShowDescription(); | |
}.observes('value') | |
}), | |
didHideOrShowDescription: function() { |
This file contains 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
var obj = SC.Object.extend({foo: null}) | |
var array = [obj.create({foo: 'bar'})] | |
function arrayObserver(array) { console.log('called') } | |
var observer = SC.RangeObserver.create(array, SC.IndexSet.create(0, array.get('length')), undefined, arrayObserver, YES) | |
observer.beginObserving() | |
array.replace(0, obj.create({foo: 'baz'})) | |
array.objectAt(0).set('foo', 'fnord') |
This file contains 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
class Object | |
def chain_method(with_symbol, &with_block_returned_from) | |
old_method = method with_symbol | |
new_method = with_block_returned_from.call old_method | |
eigenclass = class << self; self; end | |
eigenclass.class_eval do | |
define_method with_symbol, new_method | |
end | |
end | |
end |