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
Stephenson, G. R. (1967). Cultural acquisition of a specific learned response among rhesus monkeys. In: Starek, | |
D., Schneider, R., and Kuhn, H. J. (eds.), Progress in Primatology, Stuttgart: Fischer, pp. 279-288. | |
mentioned in: Galef, B. G., Jr. (1976). Social Transmission of Acquired Behavior: A Discussion of Tradition and | |
Social Learning in Vertebrates. In: Rosenblatt, J.S., Hinde, R.A., Shaw, E. and Beer, C. (eds.), Advances in the | |
study of behavior, Vol. 6, New York: Academic Press, pp. 87-88: | |
[...] Stephenson (1967) trained adult male and female rhesus monkeys to avoid manipulating an object and then | |
placed individual naïve animals in a cage with a trained individual of the same age and sex and the object in |
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
# -*- coding: utf-8 -*- # | |
module Rouge | |
module Lexers | |
class EmbeddedJSX < RegexLexer | |
tag :xml_inside_jsx | |
def self.analyze_text(text) | |
0 | |
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
# encoding: utf-8 | |
input = [ 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 15 ] | |
# Need to box the value to make it mutable | |
State = Struct.new(:last_value) | |
# divide the input into runs of consecutive numbers | |
s = input.slice_before(State.new(input.first)) do |value, state| | |
(_, state.last_value = value != state.last_value.succ, value)[0] |
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
input = [ 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 15 ] | |
# Need to box the value to make it mutable | |
State = Struct.new(:last_value) | |
def returning(value) yield; value; end | |
# divide the input into runs of consecutive numbers | |
s = input.slice_before(State.new(input.first)) do |value, state| | |
returning(value != state.last_value.succ) do |
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
NAME = "ruby3" # eg: JAERLANG, RAILS -*- ruby -*- | |
# This stanza is for the creation of the code .zip and .tgz files. | |
# It's also used for the .mobi file | |
TITLE = "Programming Ruby 1.9" | |
AUTHOR = "Thomas, with Fowler and Hunt" | |
CODE_IGNORE_LIST = "README" | |
require "../PPStuff/util/rake/main.rb" |
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
# A poor implementation of FizzBuzz, just to show code coverage stuff | |
1.upto(100).with_object('') do |i, x| | |
if i % 3 == 0 | |
x += 'Fizz' | |
end | |
if i % 5 == 0 | |
x += 'Buzz' | |
end | |
if x.empty? |
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
require 'coverage' | |
Coverage.start | |
STDOUT.reopen("/dev/null") | |
require_relative 'fizzbuzz.rb' | |
Coverage.result.each do |file_name, counts| | |
File.readlines(file_name).each_with_index do |code_line, line_number| | |
count = counts[line_number] || "--" | |
STDERR.printf "%3s: %s", count, code_line | |
end | |
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
# Ask Nokogiri to find the row containing the header names | |
headers = table.search('thead > tr') | |
# Create a hash that maps the column name to the column index, so I can access subsequent | |
# rows' data by name | |
header_map = headers.search('th') | |
.map(&:text) | |
.each_with_index | |
.with_object({}) {|(name, index), hash| hash[name] = index} |
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 m(*args) | |
print "Args to m: ", args.inspect, " Result: " | |
120 | |
end | |
n = 6 | |
o = 2 | |
# Imagine using a language where whitespace is significant? Pah! | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rx="http://www.renderx.com/XSL/Extensions"> | |
<!-- ============================================================ --> | |
<!-- --> | |
<!-- This file makes a part of RenderX XSL Test Suite --> | |
<!-- --> | |
<!-- Author: Alexander Peshkov --> | |
<!-- --> | |
<!-- (c) RenderX, 2003 --> | |
<!-- --> |