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
begin | |
CREATE (:`Movie`:`UNIQUE IMPORT LABEL` {`released`:1999, `tagline`:"Welcome to the Real World", `title`:"The Matrix"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1964, `name`:"Keanu Reeves"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1967, `name`:"Carrie-Anne Moss"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1961, `name`:"Laurence Fishburne"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1960, `name`:"Hugo Weaving"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1967, `name`:"Andy Wachowski"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1965, `name`:"Lana Wachowski"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1952, `name`:"Joel Silver"}); | |
CREATE (:`Person`:`UNIQUE IMPORT LABEL` {`born`:1978, `name`:"Emil Eifrem"}); |
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"?> | |
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> | |
<graph id="G" edgedefault="directed"> | |
<node id="n0" labels=":Movie"><data key="labels">:Movie</data><data key="tagline">Welcome to the Real World</data><data key="title">The Matrix</data><data key="released">1999</data></node> | |
<node id="n1" labels=":Person"><data key="labels">:Person</data><data key="name">Keanu Reeves</data><data key="born">1964</data></node> | |
<node id="n2" labels=":Person"><data key="labels">:Person</data><data key="name">Carrie-Anne Moss</data><data key="born">1967</data></node> | |
<node id="n3" labels=":Person"><data key="labels">:Person</data><data key="name">Laurence Fishburne</data><data key="born">1961</data></node> | |
<node id="n4" labels=":Person"><data key="labels">:Person</data><data key="name">Hugo Weaving</data><data key="born"> |
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
# Gemfile | |
gem 'ruby-prof' | |
# code to profile | |
require 'ruby-prof' | |
RubyProf.start | |
# run code | |
result = RubyProf.stop | |
printer = RubyProf::CallStackPrinter.new(result) |
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
# this is ugly and terrible, don't do this | |
module ActiveRecord | |
module ConnectionAdapters | |
class TableDefinition | |
def column(name, type, options = {}) | |
name = name.to_s | |
type = type.to_sym | |
column = self[name] || new_column_definition(@base, name, type) |
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
/** | |
* Builder pattern for factories, mimic use of FactoryGirl traits. | |
* usage: factories.boostedBoost({retweets: 1}).twitter().withdrawn().geo(11217).generate(); | |
* must call `generate` as last step | |
* may pass options to initial method call, as well as subsequent method calls | |
*/ | |
function addFactory(factoryName, config) { | |
// add trait function to generated Factory | |
function addTrait(k, Factory, config) { | |
Factory.prototype[k] = 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
Benchmarking 127.0.0.1 (be patient) | |
Finished 450 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 199 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 390 requests | |
Server Software: thin | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 448 requests | |
Server Software: WEBrick/1.3.1 | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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 Array | |
def take_select n, &block | |
count = 0 | |
res = [] | |
select do |x| | |
r = yield x | |
if r == true | |
count += 1 | |
res << x | |
end |