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 'socket' | |
p Socket.getaddrinfo("www.ruby-lang.org", "http", nil, :STREAM) |
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
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | |
# code is released under a tri EPL/GPL/LGPL license. You can use it, | |
# redistribute it and/or modify it under the terms of the: | |
# | |
# Eclipse Public License version 1.0 | |
# GNU General Public License version 2 | |
# GNU Lesser General Public License version 2.1 | |
# Exercise Hash and Set (which is also Hash) insertion and lookup performance. | |
# Creates a graph with an adjacency map. Finds the connected subgraph from a |
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
class A | |
def foo(a, b, c) | |
p [a, b, c] | |
end | |
end | |
class B < A | |
def foo(a, (b, c), d) | |
a = 5 # modify a - the super call sees it | |
b = 6 # modify b - the super call doesn't see it |
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
# Exercise Hash and Set (which is also Hash) insertion and lookup performance. | |
# Creates a graph with an adjacency map. Finds the connected subgraph from a | |
# root node, using an Array work list and a visited Set. | |
require 'set' | |
size = 100_000 | |
class Node | |
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
Thread has been interrupted (Interrupt) | |
Backtrace: | |
{ } in Rubinius::Loader#signals at kernel/loader.rb:100 | |
Proc#call at kernel/bootstrap/proc.rb:20 | |
Signal.run_handler at kernel/common/signal.rb:75 | |
Rubinius.received_signal at kernel/delta/rubinius.rb:215 | |
Object#connected at ../connected.rb+79 | |
{ } in Object#__script__ at /Users/chrisseaton/Documents/ruby/connected.rb:43 |
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
module Foo | |
extend self | |
def foo(a, b, c) | |
hash = {a: a, b: b, c: c} | |
array = hash.map { |k, v| v } | |
x = array[0] | |
y = [a, b, c].sort[1] | |
x + y | |
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
#include <stdio.h> | |
struct Foo { | |
int x; | |
}; | |
int baz(int *bar) { | |
return *bar; | |
} |
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/jruby -X+T bin/irb | |
irb(main):001:0> Truffle::CExt.inline %s{ | |
irb(main):002:0: #include <unistd.h> | |
irb(main):003:0: #include <stdio.h> | |
irb(main):004:0: }, %s{ | |
irb(main):005:0: printf("Hello, World! I'm %d\n", getpid()); | |
irb(main):006:0: } | |
Hello, World! I'm 36641 | |
=> true | |
irb(main):002:0> exit |
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/jruby -X+T bin/irb | |
irb(main):001:0> Truffle::CExt.inline %s{ #include <stdio.h> }, %s{ printf("Hello, World!\n"); } | |
Hello, World! | |
=> true | |
irb(main):002:0> exit |
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
# Copyright © 2004-2013 Brent Fulgham | |
# | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# * Redistributions of source code must retain the above copyright notice, | |
# this list of conditions and the following disclaimer. | |
# |