Skip to content

Instantly share code, notes, and snippets.

View eregon's full-sized avatar

Benoit Daloze eregon

View GitHub Profile
[] ~/projects/rubyspec $ git log | grep 2015 | wc -l
1021
[] ~/projects/rubyspec $ git log | grep 2014 | wc -l
410
[] ~/projects/rubyspec $ git log | grep 2013 | wc -l
961
[] ~/projects/rubyspec $ git log | grep 2012 | wc -l
@headius
headius / 0.soft_ordering.diff
Last active September 6, 2016 13:59
Four impls of thread-safe Array#at for JRuby
diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java
index 04fbeef..1c32bb39 100644
--- a/core/src/main/java/org/jruby/RubyArray.java
+++ b/core/src/main/java/org/jruby/RubyArray.java
@@ -71,6 +71,7 @@ import org.jruby.util.io.EncodingUtils;
import java.io.IOException;
import java.lang.reflect.Array;
+import java.lang.reflect.Field;
import java.util.Arrays;
@smarr
smarr / presentations.md
Last active November 25, 2016 04:53
Truffle/Graal at SPLASH'16

Truffle and Graal-related Presentations at SPLASH'16

Meta'16

  • [AST Specialisation and Partial Evaluation for Easy High-Performance Metaprogramming][7] ([PDF][7pdf])
    Chris Seaton, Oracle Labs
    Sun 30 Oct 2016, 11:30-12:00 - Meta'16

Abstract

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
void on_signal(int sig) {
printf("\nIN handler\n");
//nothing
}
@k0kubun
k0kubun / benchmark_driver.optcarrot.log
Last active February 25, 2018 12:55
Optcarrot benchmark using benchmark_driver.gem: Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores
$ cat benchmark.yml
# Config for benchmark_driver.gem
type: command_stdout
name: optcarrot
command: bin/optcarrot --benchmark examples/Lan_Master.nes
metrics_type:
unit: fps
stdout_to_metrics: |
match = stdout.match(/^fps: (?<fps>\d+\.\d+)$/)
Float(match[:fps])
@juliocesar
juliocesar / testing_front_end_rspec_capybara.md
Created October 21, 2010 23:51
Testing front-end for a Sinatra app with RSpec and Capybara

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile

@eregon
eregon / precise_time.c
Last active September 22, 2019 13:44
A variant of time(1) to measure startup precisely, able to show real time in milliseconds and max RSS in MB. Moved to https://github.com/eregon/precise-time
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
@ariera
ariera / README.markdown
Created August 7, 2011 16:23
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group
@eregon
eregon / benchmark-block
Last active September 19, 2020 14:07
benchmark block - a prototype to benchmark a block without the block overhead
#!/usr/bin/env ruby
private def benchmark(name = nil, &block)
raise "needs a block" unless block
binding = block.binding
file, line = block.source_location
start_line = line - 1
lines = File.readlines(file)
indent = lines.fetch(start_line)[/^(\s+)/, 1]
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do