Skip to content

Instantly share code, notes, and snippets.

View paulosuzart's full-sized avatar

Paulo Suzart paulosuzart

View GitHub Profile
(defmonad elvs-m
[m-result (fn m-rsult-elvs [v] v)
m-bind (fn m-bind-elvs [v o]
(if (nil? v) o v))])
(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
(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"})))
(ns moyure.db)
(def id (ref 0))
(def db
(ref {}))
(defn nextval []
(dosync (alter id inc)))
(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
@import <Foundation/CPObject.j>
@import <Foundation/CPURLConnection.j>
@import <Foundation/CPURLRequest.j>
@implementation AppController : CPObject
{
CPTextField label;
}
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()]
};
var {Response} = require('ringo/webapp/response');
export ('index');
function index(req) {
return Response.json ({uuid: "Teste"});
}
(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]))
(ns poly
(:use [clojure.contrib.json]
[clojure.contrib.prxml]))
(defprotocol PSerializable
(to-json [i])
(to-xml [i]))