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 | |
# Let's just worry about what's done to Array directly, and not the insanity | |
# in any of the parent classes. | |
$existing_methods = [] | |
def print_methods(library) | |
new_methods = ([].methods.sort - [].class.superclass.methods.sort) - $existing_methods | |
for method in new_methods |
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
# Ruby tends to pass by reference. | |
# http://groups.google.com/group/ruby-talk-google/msg/aa5cdea350f46314 | |
# | |
# Notice all the same object ID in the output. | |
# | |
class Test | |
def self.test | |
hash = {:entry => ""} | |
array = [] |
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
<?php | |
abstract class Model { | |
static abstract function getFields(); | |
static function getFieldsForSQL() { | |
return implode(', ', self::getFields()); | |
} | |
static function getAll() { |
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
<?php | |
abstract class Model { | |
static abstract function getFields(); | |
static function getFieldsForSQL() { | |
return implode(', ', self::getFields()); | |
} | |
static function getAll() { |
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('http') | |
.createServer(function(request, response){ | |
setTimeout(function() { | |
response.sendHeader(200, {'Content-Type' : 'text/plain'}); | |
response.sendBody("zoom"); | |
response.finish(); | |
}, 2000); | |
}) | |
.listen(8000); |
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
# how to test that this works? | |
# or would you even bother? | |
... | |
begin | |
require 'system_timer' | |
rescue LoadError | |
require 'timeout' | |
SystemTimer = Timeout |
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
<div class="actions left"> | |
<h3>Home</h3> | |
<% @home_actions.each do |player_action| %> | |
<%=h player_action.inspect %><br /> | |
<% end %> | |
</div> | |
<div class="actions right"> | |
<h3>Away</h3> | |
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
before: | |
def process_message message | |
logger.debug "Started #{message.headers["message-id"]}" | |
event = JSON.parse message.body | |
logger.debug "Action: #{event['action']}" | |
match_id = event['matchID'] | |
active_entries = PassingGame::Entry.count_active_for match_id | |
logger.info "#{active_entries} active entries for match_id = #{match_id}" | |
if fail_on? event |
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
craig@zuu 0 ruby-1.9.3-p194 ~$ ruby ./example.rb 2>example.err 1>example.out | |
craig@zuu 0 ruby-1.9.3-p194 ~$ cat example.err | |
STDERR | |
craig@zuu 0 ruby-1.9.3-p194 ~$ cat example.out | |
STDOUT |
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
- (uint8_t *)SHA256; |
OlderNewer