Skip to content

Instantly share code, notes, and snippets.

@qrush
qrush / security.md
Last active August 29, 2015 14:24
Package manager service surveys. Additions/corrections welcome.
require 'YOUR_APPLICATION'
run Sinatra::Application
# :PROCESS: ruby, "ruby %f 2>&1"
# :BRACKET_CODE: "[ruby]", "[/ruby]"
# :TEXT:
#
# In the <a
# href="http://devver.net/blog/2009/06/a-dozen-or-so-ways-to-start-sub-processes-in-ruby-part-1/">previous
# article</a> we looked at some basic methods for starting subprocesses in Ruby.
# One thing all those methods had in common was that they didn't permit a lot of
# communication between parent process and child. In this article we'll examine
# a few built-in Ruby methods which give us the ability to have a two-way
Installing Ruby 2.0.0 on Kindle
===============================
So I've just jailbroken my Kindle, and want to run Ruby on it.
This is what I have right now on my Kindle:
* [KUAL](http://www.mobileread.com/forums/showthread.php?t=203326), the Kindle Unified Applications Launcher
* [KTERM](http://www.fabiszewski.net/kindle-terminal/) with tmux
Make sure you've also enabled `usbnetwork` so that you can SSH to your kindle via USB.
#!/usr/bin/env ruby
# this tool is similar to "git bisect" one, but for specs.
# it tries to find what spec from list of specs breaks execution of one specified spec.
#
# see more at http://zed.0xff.me/2010/01/28/rspec-bisect
#
# usage example:
# ./rspec-bisect.rb spec/**/*_spec.rb spec/controllers/spaces/tickets_controller_spec.rb
# [.] rspec runner: ./script/spec
@schneems
schneems / gist:e09c95da37a8c50047a8
Created May 12, 2015 18:23
Find 50 most popular Gems that have mime-types as a dependency
require 'net/http'
require 'json'
def rubygems_get(gem_name: "", endpoint: "")
path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json"
JSON.parse(Net::HTTP.get("rubygems.org", path))
end
results = rubygems_get(gem_name: "mime-types", endpoint: "reverse_dependencies")
@avdi
avdi / countdown_prompt.rb
Created July 17, 2009 00:03
A command-line prompt with a timeout and countdown.
# :PUBLISHER: markdown, shell, { command: 'rdiscount' }
# :BRACKET_CODE: '[ruby]', '[/ruby]'
# :TEXT:
#
# Have you ever started a long operation and walked away from the computer, and
# come back half an hour later only to find that the process is hung up waiting
# for some user input? It's a sub-optimal user experience, and in many cases it
# can be avoided by having the program choose a default if the user doesn't
# respond within a certain amount of time. One example of this UI technique in
# the wild is powering off your computer - most modern operating systems will
@schacon
schacon / classy_git.md
Created November 12, 2010 20:48
RubyConf Talk
require 'rubygems'
require 'time'
require 'fileutils'
require 'httparty'
require 'nokogiri'
require 'pp'
APIToken = 'your-api-token-goes-here'
APIServer = 'http://sample.campfirenow.com'
@nzakas
nzakas / gist:880432
Created March 21, 2011 23:08
Get updates list before merging
# I was trying to figure out how to get a list of changes made remotely on Git
# before applying. Here's what I came up with.
# First, get the latest data from the origin
git fetch origin
# Then, get the changes and output to a file
git log HEAD..origin/master > changes.txt
# Merge changes in