Skip to content

Instantly share code, notes, and snippets.

View shtirlic's full-sized avatar
📡

Serg Podtynnyi shtirlic

📡
View GitHub Profile
ruby % rvm use 1.9.2
Using /Users/qrush/.rvm/gems/ruby-1.9.2-p136
ruby % irb
ruby-1.9.2-p136 :001 > a = []
=> []
ruby-1.9.2-p136 :002 > a.push(3,)
=> [3]
ruby % rvm use ree
@simonharrer
simonharrer / gist:1173228
Created August 26, 2011 11:29
Use JRuby to create a Java Soap Web Service
require 'java'
require 'jruby/core_ext'
module WS
class WebService
def test()
puts "Call received at #{Time.new}"
# x = Result.new
# x.name = "asdf"
# return x
#!/bin/sh
rvm_current=`rvm current`
echo "Installing ruby-debug with $rvm_current ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem ruby-debug19 -- --with-ruby-include=$rvm_path/src/$rvm_current
@robotmay
robotmay / Railscasts 1 projects_controller.rb
Created May 29, 2012 22:51
The strange and wonderful world of forgotten Rails features: HTTP Streaming
class ProjectsController < ApplicationController
stream
def index
# rest of controller code
end
end
@steveklabnik
steveklabnik / pair
Created November 9, 2012 13:09
A ruby script to change pairs
#!/usr/bin/env ruby
def usage
puts "./pair [name]: pair two people"
puts "./pair : switch to just steve"
exit
end
def set_config(name, email)
`git config user.name "#{name}"`
@mm53bar
mm53bar / Gemfile
Created March 26, 2012 18:41
Automagically launch an EC2 image and then provision it using sunzi
source 'http://rubygems.org'
gem 'sunzi'
gem 'rake'
gem 'fog'
@ik5
ik5 / daemon.rb
Created June 22, 2010 18:43
a quick and dirty jruby daemon based on basic_daemon
#!/usr/bin/env jruby
#
#
require 'rubygems'
require 'spoon'
EXEC = '/tmp/exec.rb'
PID_PATH = '/tmp/exec.pid'
WORK_PATH = '/tmp/'
require 'addressable/uri'
# Source: http://gist.github.com/bf4/5320847
# Accepts options[:message] and options[:allowed_protocols]
# spec/validators/uri_validator_spec.rb
class UriValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
uri = parse_uri(value)
if !uri
@shtirlic
shtirlic / mono.rb
Last active May 21, 2017 16:55
Latest mono formula for homebrew
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2'
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77'
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'
#define STRING char *
#define IF if(
#define THEN ){
#define ELSE } else {
#define FI ;}
#define WHILE while (
#define DO ){
#define OD ;}
#define INT int
#define BEGIN {