Yorick Peterse YorickPeterse

View basic_lexer.rl
1 2 3 4 5 6 7 8 9 10
# Since public domain doesn't exist everywhere in the world and people might
# actually want to use this snippet here's the license (you can leave out
# the lines preceding it):
#
# Copyright (c) 2014, Yorick Peterse
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View growth.patch
1 2 3 4 5 6 7 8 9 10
diff --git a/rss_growth_during_redis_publish.rb b/rss_growth_during_redis_publish.rb
index f6d1526..cecfdef 100755
--- a/rss_growth_during_redis_publish.rb
+++ b/rss_growth_during_redis_publish.rb
@@ -8,6 +8,14 @@ require 'celluloid/io' # Unclear if this is required, or if Celluloid will hand
require 'celluloid/redis'
require 'celluloid/autostart'
+Thread.new do
+ loop do
View mri_211.out
1 2 3 4 5 6 7 8 9 10
desc: (none)
cmd: ruby rss_growth_during_redis_publish.rb -n 1000000
time_unit: i
#-----------
snapshot=0
#-----------
time=0
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=0
View gist:9652463
1 2 3 4 5 6 7 8 9 10
with Rubinius.synchronize:
 
$ ./bin/benchmark core/file/bench_each_byte.rb
=== rbx ===
File#each_byte with a small file
29.1 (±0.0%) i/s - 146 in 5.023101s (cycle=2)
File#each_byte with a medium file
3.3 (±0.0%) i/s - 17 in 5.228034s (cycle=1)
File#each_byte with a large file
0.3 (±0.0%) i/s - 2 in 6.110730s (cycle=1)
View bench_node.sh
1 2 3
#!/usr/bin/env bash
 
siege -c 10 -b -t 30s http://localhost:9393
View syntax.rake
1 2 3 4 5 6 7 8 9 10
namespace :syntax do
desc 'Checks the syntax of ERB files'
task :erb do
require 'action_view'
 
Dir['app/views/**/*.erb'].each do |file|
template = File.read(file)
 
begin
ActionView::Template::Handlers::Erubis \
View env_madness.md

This Gist aims to get some discussion going and throw some ideas around about introducing a more universal way to configure the environment/mode of Ruby applications and libraries (where applicable).

When speaking about the environment/mode (referred to as "environment" from this point on) we're speaking about the variable/option that specifies a alternative set of configuration options to use. That is, separate database options, hostnames and so on. A basic example of this is the standard Rails database configuration file:

View tag_count.rb
1 2 3 4 5 6 7 8 9 10
require 'httpclient'
require 'json'
 
url = 'http://www.reddit.com/r/r4r.json'
after = nil
posts = []
client = HTTPClient.new
tags = {
'[M4F]' => 0,
'[M4M]' => 0,
View PKGBUILD
1 2 3 4 5 6 7 8 9 10
pkgname=android-4.0.3
pkgver=r03
pkgrel=3
pkgdesc='Platform for Google Android SDK'
arch=('any')
url="http://developer.android.com/sdk/index.html"
license=('custom')
depends=('android-sdk>=r17')
_android_api=android-15
_android_ver=android-4.0.4
View pomodoro.sh
1 2 3 4 5 6 7 8 9
#!/usr/bin/env bash
 
time=1500 # 25 minutes
title="Pomodoro"
icon=/home/yorickpeterse/Pictures/icons/tomato.png
 
notify-send -i "$icon" "$title" "Starting a new Pomodoro timer"
 
sleep $time
Something went wrong with that request. Please try again.