Skip to content

Instantly share code, notes, and snippets.

View kouphax's full-sized avatar

James Hughes kouphax

View GitHub Profile
; DATA TYPES
(class 1)
(class "Hello")
(class 1.0)
(class \H)
(class true)
(class nil)
(class (fn [] 1))
@kouphax
kouphax / core.clj
Created September 21, 2014 21:41
A sampling of Clojure syntax (grabbed elsewhere but I've lost the source)
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)
@kouphax
kouphax / 00-index.html
Last active August 29, 2015 14:04
React Workshop
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>React Workshop</title>
<link href="https://rawgit.com/kouphax/static/master/react-workshop/stylesheets/styles.css" rel="stylesheet">
</head>
<body>
<!-- NOT REQUIRED FOR REACT BUT MAY BE HANDY LATER -->
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
(ns card-shop.core
(:require [liberator.core :refer [resource defresource]]
[liberator.dev :refer [wrap-trace]]
[ring.middleware.keyword-params :refer [wrap-keyword-params]]
[ring.middleware.params :refer [wrap-params]]
[ring.adapter.jetty :refer [run-jetty]]
[compojure.core :refer [defroutes GET]]))
(defrecord Paint [id title code quantity])
@kouphax
kouphax / 1.sql
Last active August 29, 2015 14:02
Code Samples for Play Workshop
# --- !Ups
create table quotes (
id bigint not null auto_increment,
quote varchar(max),
attributed_to varchar(255),
year int(4),
primary key (id)
);
(require '[clj-http.client :as client])
(client/get "http://YOUR_TEAMWORKSITE_HERE.teamworkpm.net"
{:basic-auth ["YOUR_API_KEY_HERE" ""] ; looks like they dont use a password
:as :json })
@kouphax
kouphax / filter.cljs
Last active August 29, 2015 14:02
Filter Example; Pub Sub Example
(ns boston.core
(:require [cljs.core.async :as async :refer [chan <! >! merge timeout filter<]])
(:require-macros [cljs.core.async.macros :as m :refer [go-loop go]]))
(enable-console-print!)
(def in-channel-one (chan))
(def in-channel-two (chan))
(def in-channel-three (chan))
@kouphax
kouphax / index.html
Created April 28, 2014 10:14
Trigger Happy Design Thoughts
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Trigger Happy</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="http://cdn.jsdelivr.net/flat-ui/2.0/css/flat-ui.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700' rel='stylesheet' type='text/css'>
@kouphax
kouphax / download.rb
Created April 27, 2014 18:26
Download all files from IATI
require 'httparty'
def log(target_file, resource_url, package_id)
File.open("downloads.log", 'a') do |file|
file.puts "#{DateTime.now.to_s} ::: Downloaded #{target_file} from #{resource_url} in #{package_id}"
end
end
Dir.mkdir("data", 0700) unless Dir.exists?("data")
@kouphax
kouphax / products.sql
Last active August 29, 2015 13:58
products.sql
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-adjust','','',0,false);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-adn','','',0,false);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-align-center','Tower of Hanoi','The hardest version of the Towers of Hanoi game. Success can only be achieved through deep inner reflection of the self.',8,true);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-align-justify','2D Jenga','A two dimnesional version of the popular Mayan game where blocks are removed by shifting them from the 2 dimensional plane',2,true);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-align-left','','',0,false);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-align-right','','',0,false);
INSERT INTO products(id, title, description, quantity, active) VALUES('fa-ambulance','Waaambulance','The perfect ride for cry babies and sore losers.',10,