Skip to content

Instantly share code, notes, and snippets.

View powellnathanj's full-sized avatar

Nathan Powell powellnathanj

  • nathanpowell.org
  • PA
View GitHub Profile
FUCK YOU JOSH
'/^[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}/'
require 'java'
include_class 'java.util.HashMap'
hm = HashMap.new
hm.put("oh", "hai")
hm.each do |k,v|
puts "#{k} => #{v}"
end
$.ajax({
type: 'GET',
dataType: 'jsonp',
url: 'http://wtfhaveubeen.nathanpowell.org/here',
success: bai(),
});
user=> (defn foo
"say hai"
[]
(println "hai"))
#'user/foo
user=> (doc foo)
-------------------------
user/foo
([])
say hai
(def db {:classname "org.sqli.jdbc.EmbeddedDriver"
:subprotocol "derby"
:subname "/tmp/clojure.contrib.sql.test.db"
:create true})
(require '[clojure.contrib.sql :as ccsql])
(def db { :classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost/hack"
:user "root"
:create true })
(defn get-star
"Print all the rows in the table"
user=> (filter (fn[n](> n 2)) '(1 2 3))
(3)
>> [1, 2, 3].select{|n| n > 2}
=> [3]
>> def select_big(ar)
>> ar.select{|n| n > 2}
>> end
>> select_big([1, 2, 3])
=> [3]
Or you could duck punch it, and re-open Array. Not as succinct as Clojure tho, ur rite there.
(import '(java.net URL))
(def url (new URL "http://nathanpowell.org/blog"))
(println (. url (getHost)))