Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
bigbuk:~ julik$ rvm install 1.8.7
Installing Ruby from source to: /Users/julik/.rvm/rubies/ruby-1.8.7-p334, this may take a while depending on your cpu(s)...
ruby-1.8.7-p334 - #fetching
ruby-1.8.7-p334 - #downloading ruby-1.8.7-p334, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4092k 100 4092k 0 0 145k 0 0:00:28 0:00:28 --:--:-- 182k
ruby-1.8.7-p334 - #extracting ruby-1.8.7-p334 to /Users/julik/.rvm/src/ruby-1.8.7-p334
ruby-1.8.7-p334 - #extracted to /Users/julik/.rvm/src/ruby-1.8.7-p334
bigbuk:tracksperanto julik$ ruby --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i386-darwin9.8.0]
bigbuk:tracksperanto julik$ rake package
(in /Code/apps/tracksperanto)
cd pkg
tar zcvf tracksperanto-2.5.0.tgz tracksperanto-2.5.0
tracksperanto-2.5.0/
tracksperanto-2.5.0/.gemtest
................. blablablabla
bigbuk:tracksperanto julik$ cd pkg/
@julik
julik / bdd.rb
Created June 21, 2011 16:36
BDD syntaxes
# Terror of BDD framerorks, by the degree of useless content of magix
# Fucking awful
@employee.should respond_to(:grant_options)
# Less awful, still pretty awful
@employee.should.respond_to(:grant_options)
# Now we are talking. Sadly no BDD, TDD or BDSM framrwork for Ruby
# handles it this way. I have no intention of writing my own though.
@julik
julik / lighty.conf
Created July 4, 2011 20:09
Making lighttpd+fcgi use Bundler and RVM
$HTTP["host"] =~ "archives" {
server.document-root = "/home/username/web-apps/yourapp/current"
server.error-handler-404 = "/config.ru"
# Change *-procs to 2 if you need to use Upload Progress or other tasks that
# *need* to execute a second request while the first is still pending.
fastcgi.server = ( ".ru" => ( "localhost" => (
"socket" => "/tmp/z.fcgi.sock",
"idle-timeout" => 20,
"max-procs" => 15, # Until we figure out forking for long requests
irb(main):010:0> self.class.const_set(:SomeClass,
irb(main):011:1* Class.new(Ancestor) do
irb(main):012:2* def initialize(var)
irb(main):013:3> print "#{self.class} initialized with #{var}"
irb(main):014:3> end
irb(main):015:2> end
irb(main):016:1> )
=> SomeClass
irb(main):017:0> SomeClass.new("foo")
SomeClass initialized with foo=> #<SomeClass:0x67b77c>
@julik
julik / form_to_structure.rb
Created July 15, 2011 16:09
How the list of middlewares is constructed in tracksperanto-web
# Converts
# ["__divider", "Scaler", "width", "10", "height", 20, "__divider", "Mover", "xx", "234"]
# to [["Scaler", {"height"=>20, "width"=>"10"}], ["Mover", {"xx"=>"234"}]]
def wrap_to_tuples(arr, split_divider = "__divider")
arr.inject([]) do | c, e |
if e == split_divider
c.push(Array.new)
else
c.push(c.pop.push(e))
end
@julik
julik / rackup
Created July 17, 2011 23:03
Surviving rackup crashes when no output is available
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
#
# This file was generated by Julik.
begin
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
@julik
julik / rackup2.rb
Created July 18, 2011 00:50
bundle+rackup replacement that actually fucking tells you what's happening
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
#
# This file was generated by Julik.
begin
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
@julik
julik / rackup2.rb
Created July 18, 2011 00:50
bundle+rackup replacement that actually fucking tells you what's happening
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
#
# This file was generated by Julik.
begin
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
g++-4.0 -c -fPIC -DUSE_GLEW -I/Applications/Nuke6.3v1/Nuke6.3v1.app/Contents/MacOS/include -msse -O3 -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -c SyLens.cpp
g++-4.0 -o SyLens.dylib -bundle -undefined warning -flat_namespace -shared -rdynamic -nodefaultlibs-ggdb -lDDImage -lGLEW -L/Applications/Nuke6.3v1/Nuke6.3v1.app/Contents/MacOS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -lDDImage -lGLEW SyLens.o