Skip to content

Instantly share code, notes, and snippets.

Created January 2, 2013 22:53
Show Gist options
  • Save anonymous/4439064 to your computer and use it in GitHub Desktop.
Save anonymous/4439064 to your computer and use it in GitHub Desktop.
import IO
# This is a comment!
main = ->
"This is a docstring!
Strings can span multiple lines!
"
print("Enter your favourite programming language: ")
name = read_line()
switch name
when "Zoidlang" then puts("Zoidlang is awesome!")
when "Haskell" then puts("Haskell is okay...")
when "PHP" then puts("You're a terrible person!")
else puts("{0} is bad and you should feel bad!".format(name))
unsafe
# Scoped imports! \o/
import <sqlite3.h>
# Let's ignore exception-safety in this crap.
# It should be wrapped in a class anyway.
db = null
err = sqlite3_open_v2("foo.sqlite3".to_cstring(), &db, 0, null)
if err == 0
# My SQL injection vulnerability is bad and I should feel bad.
sqlite3_exec(db, "INSERT INTO Names (Name) VALUES ('{0}')".format(name).to_cstring(),
null, null, null)
sqlite3_close_v2(db)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment