This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to convert a directory of Nanoblogger posts to Jekyll | |
# | |
# Nanoblogger is a command line, static blogging app, not that | |
# dissimilar to Jekyll: http://nanoblogger.sourceforge.net/ | |
# | |
# It's been years since I've used it though, but the below script | |
# worked for me in converting the files to Jekyll. | |
Dir['*.txt'].each do |f| | |
# Need to read file to find title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Pinboard Bookmark Importer | |
--An Applescript to automate importing of Pinboard.in bookmarks to a collection in Camino. To be used for occasional or one off import | |
-- pinboard username and password | |
property pbuser : "pinboard username" | |
property pbpass : "pinboard password" | |
--Download bookmarks via curl to desktop (because can use shortcut when selecting file for import via UI scripting) | |
do shell script ("cd ~/Desktop; curl https://" & pbuser & ":" & pbpass & "@pinboard.in/export/ -o pinboard.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Figured it out, was to do with Endianness: | |
http://github.com/i5m/shoes/commit/8dc81deceaa9d8172234c5adad56570da6a5baeb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |