Skip to content

Instantly share code, notes, and snippets.

View rbq's full-sized avatar

rbq

  • Germany, NRW
View GitHub Profile
@tonyhuynh
tonyhuynh / jruby-pow.txt
Last active August 29, 2015 14:01
jRuby + Pow
Pow does not support jRuby. The error you'll hit is "IOError: Socket is not connected". This PR describes a hack to get around it: https://github.com/josh/nack/pull/32
Here are the steps:
1. Open ~/Library/Application\ Support/Pow/Current/node_modules/nack/lib/nack/server.rb
2. Replace line #132 with the following:
# OLD: sock.close_read
begin
@KamilLelonek
KamilLelonek / rails_routes_reloader.rb
Created February 28, 2015 12:33
Middleware for reloading routes
# lib/rails_routes_reloader.rb
class RailsRoutesReloader
def initialize(app)
@app = app
end
def call(env)
reload_routes_if_changed
return *@app.call(env)
package jruby.ext;
import java.util.Arrays;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.jruby.embed.ScriptingContainer;
/**
* Launch a Ruby script at web application startup. To wire up this
@mccraigmccraig
mccraigmccraig / common_followers
Created July 3, 2009 12:23 — forked from DRMacIver/common_followers
ruby : find twitter common followers
#!/usr/bin/env ruby
# Trivial little twitter script
# Pass it a list of names as command line arguments
# and it will return a list of all people who follow everyone in the
# list.
# A person is implicitly assumed to follow themselves, so if foo follows
# bar and bar follows foo then common_followers foo bar would include
# both foo and bar in the output, but if bar did not follow foo it
# would include neither.
# Backs up all the photos from Google Picasa Web Albums.
#
# The script downloads the original version of the photos, and is not limited to
# 1600x1200 thumbnails.
#
# Author:: Victor Costan
# Copyright:: Copyright (C) 2010 Victor Costan
# License:: MIT
require 'yaml'
@rmanalan
rmanalan / .gems
Created January 25, 2010 20:54
Static websites using Heroku
rack-contrib
rack-rewrite
require 'sinatra'
require 'omniauth'
class Application < Sinatra::Base
use OmniAuth::Builder do
provider :github, 'github_id', 'github_secret'
end
get '/' do
@jtimberman
jtimberman / ec2_server_create_only.rb
Created January 11, 2011 14:22
this knife exec script example only creates a new instance. not wildly useful, but used as an example of the possibilities.
require 'fog'
require 'chef/knife/ec2_server_create'
connection = Fog::AWS::Compute.new(
:aws_access_key_id => Chef::Config[:knife][:aws_access_key_id],
:aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key],
:region => Chef::Config[:knife][:region]
)
server = connection.servers.create(
@Watson1978
Watson1978 / growl.rb
Created April 26, 2011 03:17
MacRuby : growl
framework 'Cocoa'
framework 'Foundation'
class Growl
GROWL_IS_READY = "Lend Me Some Sugar; I Am Your Neighbor!"
GROWL_NOTIFICATION_CLICKED = "GrowlClicked!"
GROWL_NOTIFICATION_TIMED_OUT = "GrowlTimedOut!"
GROWL_KEY_CLICKED_CONTEXT = "ClickedContext"
def initialize(app, notifications, icon = nil)
@mbinna
mbinna / UIViewController+MBSensitiveInformationInScreenshotPrevention.h
Created June 12, 2011 13:00
Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)