This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Monty Hall problem (Let's Make a Deal gameshow) | |
| ;; http://www.marilynvossavant.com/articles/gameshow.html | |
| (use '(incanter core stats charts)) | |
| ;; set a simulation sample size | |
| (def n 10000) | |
| ;; generate samples of initial-guesses, prize-doors, and switch decisions | |
| (def initial-guesses (sample [1 2 3] :size n)) | |
| (def prize-doors (sample [1 2 3] :size n)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Common minimal format for sending just lat/long data | |
| [ | |
| { | |
| uuid: "550e8400-e29b-41d4-a716-446655440000", | |
| date: "2010-04-30T16:50:00Z", | |
| location: { | |
| position: { | |
| latitude: 45.5118, | |
| longitude: -122.6433 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $client = array('client_id' => 'geoloqi_web', 'client_secret' => '1234'); | |
| $post = array( | |
| 'grant_type' => 'password', | |
| 'username' => 'aaronpk', | |
| 'password' => '1234' | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'json' | |
| require 'isaac' | |
| configure do |c| | |
| c.nick = "icecondor" | |
| c.server = "irc.freenode.net" | |
| c.port = 6667 | |
| end | |
| on :connect do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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") |
OlderNewer