Skip to content

Instantly share code, notes, and snippets.

View atomicules's full-sized avatar

atomicules atomicules

View GitHub Profile
=================
Last 20 lines...
=================
./shoes/native.h:22: warning: function declaration isn’t a prototype
./shoes/native.h:24: warning: function declaration isn’t a prototype
./shoes/native.h:40: warning: function declaration isn’t a prototype
shoes/http/nsurl.m: In function ‘-[ShoesHttp readHeaders:]’:
shoes/http/nsurl.m:114: warning: assignment discards qualifiers from pointer target type
shoes/http/nsurl.m:116: warning: assignment discards qualifiers from pointer target type
# A simple app to test Keypress, Keydown and Keyup functionality
# Reports key being pressed and changes colour with change in state
Shoes.app do
@keypress = para "Keypress: "
para "\n"
@keydown = para "Keydown:"
para "\n"
@keyup = para "Keyup: "
@kpff = 0
@kdff = 0
# testing mechanize in Ruby 1.9 based Shoes
# Assumes Mechanize is installed local to application
# Others might need this code:
=begin
Shoes.setup do
gem 'mechanize = 0.8.5' #mechanize 0.8.5 saves having to install nokogiri
end
=end
# Dummy line so it doesn't try to pick up encoding from below
# Testing "uninitialized constant Encoding::UTF_16BE" error
# that occurs in Shoes Policeman built with Ruby 1.9.1
# The below works in Shoes 2, but not in Shoes 3
#
# Problem seems to be in CGI
# See \dist\ruby\lib\cgi\utli.rb lines 37 onwards:
=begin
# Unescape a string that has been HTML-escaped
# CGI::unescapeHTML("Usage: foo "bar" <baz>")
What successful building of Shoes on OSX PPC looks like:
i5m-Powerbook:~ i5m$ cd code/github/shoes/
i5m-Powerbook:shoes i5m$ source use-deps
i5m-Powerbook:shoes i5m$ rake
(in /Users/i5m/code/github/shoes)
rm -rf dist
mkdir -p dist
In file included from /Users/i5m/code/github/shoes/deps/include/ruby-1.9.1/ruby/ruby.h:25,
from /Users/i5m/code/github/shoes/deps/include/ruby-1.9.1/ruby.h:32,
#Testing differences between Shoes 2 and 3, Ruby 1.8 and Ruby 1.9
#In Shoes 2 (and also version 1229 of Shoes 3 that I built with Ruby 1.8) this code works
#In Shoes 3, then in ui.rb ":attach => Window" must be replaced with ":attach => Shoes::Window"
#as otherwise the error "uninitialized constant UI::Window" occurs.
require 'ui'
Shoes.app do
extend UI
Figured it out, was to do with Endianness:
http://github.com/i5m/shoes/commit/8dc81deceaa9d8172234c5adad56570da6a5baeb
#For answering question on Shoes mailing list dmonroe
Shoes.app(:title => "Coplanar Points", :width => 550, :height => 400) do
def calculate
@beex = (@betax.text.to_f-@alphax.text.to_f)
@beey = (@betay.text.to_f-@alphay.text.to_f)
@beez = (@betaz.text.to_f-@alphaz.text.to_f)
@ceex = (@gammax.text.to_f-@alphax.text.to_f)
@ceey = (@gammay.text.to_f-@alphay.text.to_f)
@ceez = (@gammaz.text.to_f-@alphaz.text.to_f)
# For blog post
# New win32-api version of http://www.mustap.com/rubyzone_post_90_ruby-on-windows
require 'win32/api'
include Win32
desktop = API.new("SystemParametersInfo", ['L','L','P','L'] , 'L', "user32")
desktop.call(20,0,"c:\\my_img.bmp",0)
@atomicules
atomicules / gist:414504
Created May 26, 2010 13:48
"My vimrc file. Trying to keep it as simple and cross platform as possible
"This is no longer up to date. It got more complicated...
"My vimrc file. Trying to keep it as simple and cross platform as possible
set tabstop=4 "Number of spaces that a tab character takes
set softtabstop=4 "after reading the docs, I still don't get all the tab options.
set noexpandtab "I don't want tab characters converted to spaces
set shiftwidth=4 "number of spaces used for each step of auto-indent
set smarttab autoindent "copy indent from current line when starting new line
set guifont=Consolas:h10 "Nice font Use Inconsolata:h13 on OSX, Linux.