Skip to content

Instantly share code, notes, and snippets.

@ecarnevale
ecarnevale / domokun.rb
Created October 4, 2008 13:50
A tributeto http://domokun.tumblr.com and an attempt to play with downloads in Shoes
#
# Domokun.rb
#
# Created by Emanuel Carnevale on 2008-08-30.
# Copyright (c) 2008 emanuelcarnevale.com. All rights reserved.
#
require "hpricot"
require 'open-uri'
Shoes.app(:title => "Domo nom nom", :width => 550, :height => 600, :resizeable => false) do
@ecarnevale
ecarnevale / fontified_shoes.rb
Created October 6, 2008 19:48
A lil test app to show how the fonts appear in Shoes
# Just a lil app to test out the new fonts in Shoes.
Shoes.app do
stack do
Shoes::FONTS.each { |font|
inscription font, :stroke => red
para font, :font => font
}
end
end
class Image(webapp.RequestHandler):
def get(self):
url = "http://api.thumbalizr.com/?url=http://www.ford.de&width=250"
response = urlfetch.fetch(url)
if response.status_code == 200:
self.response.headers['Content-Type'] = "image/jpg"
self.response.out.write(response.content)
else:
self.error(404)
#
# Pong Challenge, copycat version
#
# Created by Emanuel Carnevale on 2008-11-18.
# Shamelessly adapted by http://billmill.org/pong.html
Shoes.app :width => 400, :height => 400, :resizable => false do
paddle_size = 75
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName example.com
# ServerAlias *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
@ecarnevale
ecarnevale / GetPinyin.js
Created January 27, 2009 16:04
Ubiquity command to utilize http://json-zh.appspot.com service and get pinyin reading for Chinese characters.
var noun_type_destination = new CmdUtils.NounType( "destination", ['clipboard', 'selected text', 'displayed message'] );
CmdUtils.CreateCommand({
name: "get-pinyin",
takes: {"Hanzi to read as PinYin": noun_arb_text},
preview: function(pblock, hanzi) {
searchHanzi = jQuery.trim(hanzi.text);
if (searchHanzi.length < 1) {
pblock.innerHTML = "Gets the <b>Pinyin reading</b> of selected Chinese characters.";
@ecarnevale
ecarnevale / codes.rb
Created February 13, 2009 13:29 — forked from jamis/codes.rb
# Generates a series of substitution cipher puzzles. The messages to
# "encrypt" are take from a text file passed on the command-line,
# where each message is on one line.
#
# The output is a PDF, "codes.pdf".
#
# Forked from Jamis Buck's http://gist.github.com/58141
# changed to show code as numbers instead of letters and a hint of solution instead of the key.
@ecarnevale
ecarnevale / gist:65633
Created February 17, 2009 08:15
Translit for Rails using ActiveSupport. (convert é in e and other utf8 codes in latin chars)
# from http://snippets.dzone.com/posts/show/5609
class String
def translit
ActiveSupport::Multibyte::Handlers::UTF8Handler.normalize(self,:d).split(//u).reject { |e| e.length > 1 }.join
end
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Sliding Frames</title>
<meta name="warning" content="HC SVNT DRACONES" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css" />
<style type="text/css">
div#container { overflow: hidden; visibility: hidden; }
div#navigation { position: absolute; top: 10px; left: 10px; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Scaling Background</title>
<meta name="warning" content="HC SVNT DRACONES" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css" />
<style type="text/css">
div#container { position: relative; z-index: 3; color: white; }
div#scale { position: absolute; top: 0; left: 0; z-index: 2; overflow: hidden; }