Skip to content

Instantly share code, notes, and snippets.

# Used to graph results from autobench
#
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv
#
# This will generate three svg & png graphs
require "rubygems"
require "scruffy"
require 'csv'
require 'yaml'
@gavinheavyside
gavinheavyside / trivial_file_upload_service.rb
Created November 3, 2009 20:09
Trivial file upload service using Sinatra
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])
class Demo < Prawn::Document
def flower
0.step(270, 90) do |angle|
rotate(angle, :origin => [100, 100]) do
fill_color(random_color)
polygon [100, 100], [150, 150], [200, 100]
fill_and_stroke
end
end
end
@dira
dira / omniauth.rb
Created December 1, 2010 01:56
OmniAuth strategy for a custom provider
# config/initializers/omniauth.rb
module OmniAuth
module Strategies
# tell OmniAuth to load our strategy
autoload :Pixelation, 'lib/pixelation_strategy'
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, "app_name", "secret"
@dgutov
dgutov / gist:1274520
Created October 10, 2011 02:35
ruby-indent-line advice for closing paren
(defadvice ruby-indent-line (after unindent-closing-paren activate)
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
(goto-char (cadr state))
@shirosaki
shirosaki / bar_chart.rb
Created December 24, 2011 07:01
Timing chart
#!/usr/bin/env ruby
#
# https://github.com/mattetti/googlecharts
# http://mattetti.github.com/googlecharts/
#
# Install:
# gem install googlecharts
#
# GitHub Flavord Markdown:
# ![chart title](http://chart.apis.google.com/chart?...)
@drj42
drj42 / org-mode-reference-in.org
Created February 6, 2012 23:53
This is a cheat sheet for Emacs org-mode... in org-mode format!
@paulmillr
paulmillr / active.md
Last active November 8, 2024 13:04
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
@jonforums
jonforums / gist:2882943
Created June 6, 2012 16:06
Exploring Snow Leopard VM on Win7 32bit
#### Revision: 2012-06-06
### Overview
Don't be a leech. Swagger over to the Apple Store and pony up ~$30 for the
retail Mac OS X Snow Leopard install DVD. Don't whine, just do it.
There are a number of blog posts dealing with installing either Snow Leopard or
Lion in VirtualBox. None of them worked for my Win7 Ultimate 32bit Dell Studio
15 system with a paltry 4GB. Yes, I've been holding out a new Ivy Bridge system
@luislavena
luislavena / gist:3251384
Created August 3, 2012 20:49
Testing Ruby 2.0 on Windows

Prepare for Ruby 2.0, today

Ruby 2.0 is around the corner, estimated to be launch February 2013, for its 20th anniversary!

Wouldn't be great to be able to test Ruby 2.0 features and report possible bugs?

Things like Refinements, built-in ANSI coloring for Windows or even better, faster startup

Users of other OS like Linux and OSX already can install upcoming versions of RUby thanks to RVM and rbenv tools, but what about Windows?