Skip to content

Instantly share code, notes, and snippets.

public static RubyArray local_variables19(ThreadContext context, IRubyObject recv) {
final Ruby runtime = context.runtime;
HashSet<String> encounteredLocalVariables = new HashSet<String>();
RubyArray allLocalVariables = runtime.newArray();
DynamicScope currentScope = context.getCurrentScope();
while (currentScope != null) {
RubyArray localVariables = runtime.newArray();
for (String name : currentScope.getAllNamesInScope()) {
if (IdUtil.isLocal(name) && !encounteredLocalVariables.contains(name)) {
6
4 7
2 5 10
insert(9)
new_root node (6)
Node newRoot = new Node(root.getData());
Node nextNode = root;
Node prevNode = newRoot;
while (nextNode != null) {
if (val > nextNode.getData()) {
assignNewNode(prevNode, nextNode.getLeft());
nextNode = nextNode.getRight();
} else {
assignNewNode(prevNode, nextNode.getRight());
@Who828
Who828 / Gemfile.lock
Created July 10, 2014 03:28
Bundle update
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.8)
actionpack (= 4.0.8)
mail (~> 2.5.4)
actionpack (4.0.8)
activesupport (= 4.0.8)
builder (~> 3.1.0)
erubis (~> 2.7.0)
@Who828
Who828 / Gemfile.lock
Created July 10, 2014 03:27
Bundle install
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.8)
actionpack (= 4.0.8)
mail (~> 2.5.4)
actionpack (4.0.8)
activesupport (= 4.0.8)
builder (~> 3.1.0)
erubis (~> 2.7.0)
[~/Code/gemfile/5] bundle --version
Bundler version 1.6.3
[~/Code/gemfile/5] bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using tzinfo 0.3.39
Using minitest 4.7.5
Using thread_safe 0.3.4
source 'https://rubygems.org'
gem 'activeadmin'
gem 'addressable'
gem 'aws-sdk', :require => false
gem 'bson_ext'
gem 'canable'
gem 'carrierwave'
gem 'dalli'
@Who828
Who828 / Benchmark
Last active August 29, 2015 14:01
Java 6 vs Java 8 for Persistent Data structures
# Both the benchmarks after a warmup.
Java - 6
Vector from Array
0.130000 0.000000 0.130000 ( 0.040000)
Vector#add
0.710000 0.020000 0.730000 ( 0.229000)
Array#<<
0.140000 0.000000 0.140000 ( 0.065000)
@Who828
Who828 / persistent_vector.rb
Last active January 3, 2016 23:19
A very basic version of persistent vector data structure
class Node
attr_accessor :edit, :array
def initialize(edit, list)
@edit = edit
@array = list
@count = 0
@shift = 0
end
end
@Who828
Who828 / Ruby
Created January 20, 2014 02:08
Smits-MacBook-Pro:13 Who$ bundle
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies.......................................................................
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)