Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
#!/usr/bin/env python
from twisted.internet import reactor
from twisted.web import server, resource, http
class RootResource(resource.Resource):
message = ''
def __init__(self):
@igorgue
igorgue / bmitell.hs
Created September 8, 2009 02:07
Example from Learnyouahaskell... wow
bmiTell :: (RealFloat a) => a -> String
bmiTell bmi
| bmi <= 18.5 = "You're underweight, you emo, you!"
| bmi <= 25.0 = "You're supposedly normal, Pffff, I bet you're ugly!"
| bmi <= 30.0 = "You're fat! lose some weight, fatty!"
| otherwise = "You're a whale, congratulations!"
bmiTell' :: (RealFloat a) => a -> a -> String
bmiTell' weight height
| weight / height ^ 2 <= 18.5 = "You're underweight, you emo, you!"
@igorgue
igorgue / gist:193580
Created September 25, 2009 14:37 — forked from dominiek/gist:193515
curl -d 'track=one line' http://stream.twitter.com/track.json -uonelinebot:one.onelinebot > tweets.json 2> /dev/null & tail -f tweets.json | while read tweet; do echo $tweet | grep -E -o '"screen_name":"[[:alnum:]]+"' | cut -d '"' -f 4 | while read screen_name; do echo "following: $screen_name"; curl -d '' http://twitter.com/friendships/create/$screen_name.json?follow=true -uonelinebot:one.onelinebot; done ; done
@igorgue
igorgue / gist:220844
Created October 28, 2009 21:11 — forked from leah/gist:216443
:⌉
=⌉
¦-) as opposed to |
⍥ om nom nom
# post_hello.rb
require 'rubygems'
require 'sinatra'
get '/' do
<<-form
<h1>Name to say hi!</h1>
<form method="post">
<input type="text" name="name">
<input type="submit" value="send">
@ezrabutler/people-with-souls 2 0
@JesycaL/miami 44 0
@walelia/techies 59 0
@JosueR/refreshmiami 37 0
@mherzber/friends 53 1
@mherzber/miami 70 1
@yvetteferry/south-florida 500 7
@yvetteferry/usual-suspects 204 6
@alexdc/south-florida-rocks 84 2
@TheDudeDean/florida-tweople 266 7
# post_hello.rb
require 'rubygems'
require 'sinatra'
before do
@hi_msg = "HAI!"
request.path_info = '/'
end
get '/' do
[user]
name = Igor Guerrero Fonseca
email = [email protected]
#!/usr/bin/env python
print "Hola"
# app.rb
require 'rubygems'
require 'sinatra'
require 'sequel'
configure do
DB = Sequel.sqlite('blog.db')
DB.create_table? :posts do
primary_key :id