This file contains 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
(defmonad elvs-m | |
[m-result (fn m-rsult-elvs [v] v) | |
m-bind (fn m-bind-elvs [v o] | |
(if (nil? v) o v))]) |
This file contains 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
(ns moyure.core | |
(:use compojure.core hiccup.core ring.adapter.jetty) | |
(:require [compojure.route :as route])) | |
(def hel | |
(html [:html | |
[:body | |
[:span "Hello"]]])) | |
(defroutes hello |
This file contains 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
(ns moyure.test.db | |
(:use [moyure.db]) | |
(:use [clojure.test])) | |
(deftest db-t | |
(testing "db" | |
(testing "should return 1 in the first insertion and 2 in the second." | |
(is (= 1 (insert-meet {:title "test" :when "today"}))) | |
(is (= 2 (insert-meet {:title "doc" :when "saturday"}))) |
This file contains 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
(ns moyure.db) | |
(def id (ref 0)) | |
(def db | |
(ref {})) | |
(defn nextval [] | |
(dosync (alter id inc))) |
This file contains 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
(ns enlive | |
(:use [net.cgrand.enlive-html]) | |
(import java.net.URL)) | |
(def target "http://www.programadorpoliglota.com.br") | |
(defn citations | |
"check if the given twitter user u was cited." | |
[u] | |
(let [tweets (-> target URL. html-resource |
This file contains 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
@import <Foundation/CPObject.j> | |
@import <Foundation/CPURLConnection.j> | |
@import <Foundation/CPURLRequest.j> | |
@implementation AppController : CPObject | |
{ | |
CPTextField label; | |
} |
This file contains 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
var Jack = require('jack'); | |
var i = require('uuid').uuid; | |
var handler = {}; | |
handler["/"] = function(env) { | |
return { | |
status : 200, | |
headers : {"Content-Type" : "text/plain"}, | |
body : ["Generated UID:" + i()] | |
}; |
This file contains 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
var {Response} = require('ringo/webapp/response'); | |
export ('index'); | |
function index(req) { | |
return Response.json ({uuid: "Teste"}); | |
} |
This file contains 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
(ns prot) | |
(defprotocol PWalk | |
"the implementations of this prot shold walk" | |
(walk [i])) | |
(defprotocol PBark | |
"the implementations of this prot should bark" | |
(bark [i times])) |
This file contains 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
(ns poly | |
(:use [clojure.contrib.json] | |
[clojure.contrib.prxml])) | |
(defprotocol PSerializable | |
(to-json [i]) | |
(to-xml [i])) | |