Skip to content

Instantly share code, notes, and snippets.

View kouphax's full-sized avatar

James Hughes kouphax

View GitHub Profile
@kouphax
kouphax / bundles
Last active August 29, 2015 13:56
some linuxy codez for JVM based development
#! /bin/bash
# lite weight vundle thing for vim bundles. requires pathogen
bundles=(
kien/ctrlp.vim
emezeske/paredit.vim
tpope/vim-classpath
tpope/vim-fireplace
cschlueter/vim-wombat
scrooloose/nerdtree
kien/rainbow_parentheses.vim
@kouphax
kouphax / calendars.clj
Created March 7, 2014 15:47
A few clojure functions for generating data representations of calendars
(ns calendars.core
(require [clj-time.core :as time]))
(declare in-same-month?)
(declare first-day-of-week)
(declare weekyears-between)
(defn week-calendar
"Given a starting date this function will return a LazySeq of the enclosing date
for the same month of the start-date. Week days that are not in the the same

Keybase proof

I hereby claim:

  • I am kouphax on github.
  • I am kouphax (https://keybase.io/kouphax) on keybase.
  • I have a public key whose fingerprint is E78D C727 7FAF CC48 C02D 7C50 997E 28FC 90EB DA51

To claim this, I am signing this object:

@kouphax
kouphax / Application.scala
Created March 9, 2014 16:24
Some JSON magic in Play.
package controllers
import play.api._
import play.api.mvc._
import play.api.libs.json._
import play.api.libs.functional.syntax._
object Application extends Controller {
@kouphax
kouphax / scrape.clj
Created March 10, 2014 13:21
scrapes the download links for qcon2014 slides
(ns qcon2014.core
(require [net.cgrand.enlive-html :refer [html-resource select]]))
(defn get-slide-links []
(->> ["wednesday" "thursday" "friday"]
(map #(str "http://qconlondon.com/london-2014/schedule/" % ".jsp"))
(map #(html-resource (java.net.URL. %)))
(mapcat #(select % [:a]))
(filter #(= (:content %) '("Download slides")))
(map #(get-in % [:attrs :href]))
@kouphax
kouphax / calendars.clj
Created March 13, 2014 11:22
Build calendars for things in Clojure
(ns evident.core
(require [clj-time.core :as time]))
(declare in-same-month?)
(declare first-day-of-week)
(declare weekyears-between)
(defn week-calendar
"Given a starting date this function will return a LazySeq of the enclosing date
for the same month of the start-date. Week days that are not in the the same
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kouphax
kouphax / README.md
Last active August 29, 2015 13:57
Clojure work to reomve embedded gists and replace with code blocks

Not a big fan of the my old embedded gists in posts so lets get them outta here.

  • Find all posts (historical ones) that have gists
  • Get the raw gist content and possibly syntax type (probably via api)
  • syntax highlight that
  • replace script tags (and noscript tags) with the generated syntax highlights code in a pre tag
  • win big
  • hilary
@kouphax
kouphax / README.md
Last active August 29, 2015 13:57
Ungisting Files and Tidying up Metadata

This gist covers

  • some of the snippets of code that was used to remove the gists from generated pages.
  • The tidying up of metadata and project strcuture
@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,