Skip to content

Instantly share code, notes, and snippets.

View davorb's full-sized avatar
👋

Davor Babić davorb

👋
View GitHub Profile
lorem_ipsum = <<EOS
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint
long_line = <<EOS
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint
def paintControl(paint_event)
gc = paint_event.gc
gcs_reset gc
@dsl.width = @dsl.opts[:width] ? @dsl.opts[:width] : @parent.width
@dsl.height = @dsl.opts[:height] ? @dsl.opts[:height] : @parent.height
sw = @dsl.strokewidth
gc.setForeground (@dsl.color.to_native)
gc.setLineWidth sw
gc.drawRoundRectangle(@parent.left+sw/2, @parent.top+sw/2,
@dsl.width-sw, @dsl.height-sw, @dsl.curve*2, @dsl.curve*2)
require 'facets/kernel/constant'
require 'facets/string'
module Shoes
class Configuration
class << self
def reset
@logger = nil
@logger_instance = nil
end
@davorb
davorb / shoesspec.txt
Created June 10, 2012 01:39
rake spec 10/6/12
# I did git clone git@github.com:shoes/shoes4.git right before running rake spec
Shoes::Line
basic
behaves like movable object
 moves (FAILED - 1)
behaves like object with stroke
 sets on receiver (FAILED - 2)
 returns a color (FAILED - 3)
 defaults to black (FAILED - 4)
@davorb
davorb / gist:2898983
Created June 9, 2012 01:24
pry: colors.rb
PS D:\dev\shoes4\lib\shoes> pry
You should: `gem install win32console` for better auto-indent and color support.
[1] pry(main)> require 'color.rb'
=> true
[3] pry(main)> red=Shoes::COLORS[:red]
=> #<Shoes::Color:0x0000000 @alpha=255, @blue=0, @green=0, @red=255>
[4] pry(main)> blue=Shoes::COLORS[:blue]
=> #<Shoes::Color:0x0000000 @alpha=255, @blue=255, @green=0, @red=0>
[5] pry(main)> red==red
=> true
@davorb
davorb / chapter1.hs
Created May 13, 2012 17:54
chapter1-dropbox.hs
{-
Chapter 1
1. The product of the first two digits is 24.
2. The fourth digit is half of the second digit.
3. The sum of the last two digits is the same as the sum of the first and third digits.
4. The sum of all the digits is 26.
5. The second and third digits add up to the last digit.
-}
ArrayList[] nodeEdges = new ArrayList[10]; // names.length eller size
nodeEdges[0] = new ArrayList<Edge>();
nodeEdges[1] = new ArrayList<Edge>();
@davorb
davorb / c1.txt
Created May 4, 2012 12:08
With a folder called "java" in the $PATH and without
[davor@athena ~]$ rvm --version
rvm 1.13.0 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
[davor@athena ~]$ rm -rf .rvm
[davor@athena ~]$ curl -L get.rvm.io | bash;rvm reload;rvm install jruby
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 185 100 185 0 0 290 0 --:--:-- --:--:-- --:--:-- 1000
100 8844 100 8844 0 0 6185 0 0:00:01 0:00:01 --:--:-- 2878k
// don't do this
String s = "";
for (int i = 0; i < args.length; i++) {
s += array[i];
}