Skip to content

Instantly share code, notes, and snippets.

View hackervera's full-sized avatar
😻

Veronika Tyler hackervera

😻
View GitHub Profile
$ rvm install jruby
jruby-1.6.7.2 - #downloading jruby-bin-1.6.7.2, this may take a while depending on your connection...
jruby-1.6.7.2 - #extracting jruby-bin-1.6.7.2 to /Users/tony/.rvm/src/jruby-1.6.7.2
jruby-1.6.7.2 - #extracted to /Users/tony/.rvm/src/jruby-1.6.7.2
jruby-1.6.7.2 - #nailgun
Error running 'jruby_install_build_nailgun', please read /Users/tony/.rvm/log/jruby-1.6.7.2/nailgun.log
@timmc
timmc / fact.swear.clj
Last active July 5, 2022 13:34
Factorial in Clojure without using alphanumeric characters
;; It all started here: http://clojure-log.n01se.net/date/2011-04-06.html#19:04
(#((% (+(*))) %) ;; call arg 1 with all args
[;; data
(+ (*)(*)(*)(*)(*)(*)(*))
;; main fn -- simulate 'if' with map lookup and closures
#(({(+) (% (+(*)(*)))} ;; if zero return 'then' clause
(% (+)) ;; dispatch on first arg
(% (+(*)(*)(*)))) ;; call 'else' clause (n not found in map)
%)
@stuarthalloway
stuarthalloway / gist:2645453
Created May 9, 2012 15:22
Datomic queries against Clojure collections
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
@stuartsierra
stuartsierra / errors.clj
Created April 20, 2012 14:27
Example error messages from common mistakes with Datomic
;; Some example error messages resulting from common mistakes
;; using Datomic 0.8.4138
(ns errors
(:use [datomic.api :as d :only (db q)]))
(def uri "datomic:mem://database")
(d/create-database uri)
@aaronpk
aaronpk / gist:899244
Created April 2, 2011 05:02
Sending location data to the Geoloqi streaming server
require 'rubygems'
require 'socket'
socket = TCPSocket.new("stream.geoloqi.com", 40000)
puts socket.recv(100)
socket.write('your-access-token')
socket.flush
# The server outputs a confirmation message after connecting
puts socket.recv(1000)
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@hackervera
hackervera / gist:543455
Created August 22, 2010 07:04
build-couchdb geocouch
git checkout geocouch
(in /root/build-couchdb)
** Invoke default (first_time)
** Invoke couchdb:clean_install (first_time)
** Invoke couchdb:build (first_time)
** Invoke erlang:build (first_time)
** Invoke known_distro (first_time)
** Invoke known_mac (first_time)
** Execute known_mac
** Invoke known_ubuntu (first_time)
@nborwankar
nborwankar / nitin_jchris_evently_chat
Created August 13, 2010 01:45
Transcript of skype chat between Nitin Borwankar and J Chris Anderson
Nitin Borwankar: So big picture question that helps me understand why I should spend time grokking evently - two part question
Nitin Borwankar: a) why did you feel the need to create yet another framework b) what can I do with evently I couldn't do with
jQuery events etc?
Chris Anderson: evently was a natural consequence of using jquery
Chris Anderson: it just wraps up all the repetitive crap I kept doing in jquery, and does it automatically
Chris Anderson: so b) nothing
Nitin Borwankar: ok cool
Nitin Borwankar: second q
Chris Anderson: I think evently was discovered not invented
Nitin Borwankar: what are the component files of an evently minimal app (there's too much in a couchapp to tell what's essential
require 'json'
require 'isaac'
configure do |c|
c.nick = "icecondor"
c.server = "irc.freenode.net"
c.port = 6667
end
on :connect do
<?php
$client = array('client_id' => 'geoloqi_web', 'client_secret' => '1234');
$post = array(
'grant_type' => 'password',
'username' => 'aaronpk',
'password' => '1234'
);