Skip to content

Instantly share code, notes, and snippets.

View kyrylo's full-sized avatar

Kyrylo Silin kyrylo

View GitHub Profile
ls /tmp/.X11-unix
.gradient (@color-from: #EEFF99, @color-to: #66EE33) {
background: #EEFF99;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(@color-from), to(@color-to));
background: -webkit-linear-gradient(@color-from, @color-to);
background: -moz-linear-gradient(@color-from, @color-to);
background: -ms-linear-gradient(@color-from, @color-to);
background: -o-linear-gradient(@color-from, @color-to);
background: linear-gradient(@color-from, @color-to);
-pie-background: linear-gradient(@color-from, @color-to);
}
# Replace this:
$create_game_with_scene = :main_menu unless defined? $create_game_with_scene
# By:
$create_game_with_scene ||= :main_menu
require 'ray'
class BackgroundScene < Ray::Scene
def setup
@bg_color = Ray::Color.yellow
end
def render(win)
win.clear @bg_color
end
class Suit
def red?; not black?; end
end
class Heart < Suit
def black?; false; end
end
class Diamond < Suit
def black?; false; end
create_suit = lambda { |arg|
Class.new do
define_method :black? do arg end
end
}
Heart = create_suit.call(false)
Diamond = create_suit.call(false)
Club = create_suit.call(true)
Spade = create_suit.call(true)
@kyrylo
kyrylo / gist:1683470
Created January 26, 2012 15:59
256 colors in the terminal
perl -e 'foreach $i (0..255) {printf("\e[38;5;$i"."m%03d\e[0m ",$i); }'
on :client_create do |c|
c.views.find { |view| c.focus if Subtlext::View.current == view }
end
@kyrylo
kyrylo / gist:1781966
Created February 9, 2012 18:48
Fatal error in the editor when clicking on the battleground
[2012-02-09 20:37:47.754 +0200 INFO] Entered State: SmashAndGrab::States::EditLevel
FATAL ERROR - NoMethodError: undefined method `[]' for nil:NilClass
/usr/lib/ruby/gems/1.9.1/gems/smash_and_grab-0.0.6alpha/lib/smash_and_grab/map/tile.rb:95:in `type='
/usr/lib/ruby/gems/1.9.1/gems/smash_and_grab-0.0.6alpha/lib/smash_and_grab/history/editor_actions/set_tile_type.rb:10:in `do'
/usr/lib/ruby/gems/1.9.1/gems/smash_and_grab-0.0.6alpha/lib/smash_and_grab/history/action_history.rb:42:in `do'
/usr/lib/ruby/gems/1.9.1/gems/smash_and_grab-0.0.6alpha/lib/smash_and_grab/states/edit_level.rb:128:in `update'
/usr/lib/ruby/gems/1.9.1/gems/chingu-0.9rc7/lib/chingu/game_state_manager.rb:280:in `update'
/usr/lib/ruby/gems/1.9.1/gems/chingu-0.9rc7/lib/chingu/window.rb:144:in `intermediate_update'
/usr/lib/ruby/gems/1.9.1/gems/chingu-0.9rc7/lib/chingu/window.rb:112:in `update'
/usr/lib/ruby/gems/1.9.1/gems/smash_and_grab-0.0.6alpha/lib/smash_and_grab/main.rb:90:in `<top (required)>'