Skip to content

Instantly share code, notes, and snippets.

View flashingpumpkin's full-sized avatar
🏠
Working from home

Alen Mujezinovic flashingpumpkin

🏠
Working from home
View GitHub Profile
// @name HN Black Font
// @description Make text black on HN
// @homepage https://gist.github.com/1600378/
// @match https://news.ycombinator.com/*
// @match http://news.ycombinator.com/*
// @run-at document-start
(function() {
var css, head, node;
css = "td { color: #000000; }";
@flashingpumpkin
flashingpumpkin / glapi.clj
Created January 6, 2012 01:22
The LWJGL API wrapped in Clojure
; Depends on importer.clj
(ns gltut.glapi (:use [gltut.importer]))
(import-method org.lwjgl.opengl.GL11 glArrayElement gl-array-element)
(import-method org.lwjgl.opengl.GL11 glLineStipple gl-line-stipple)
(import-method org.lwjgl.opengl.GL11 glDrawArrays gl-draw-arrays)
(import-method org.lwjgl.opengl.GL11 glDrawElements gl-draw-elements)
(import-method org.lwjgl.opengl.GL11 glBlendFunc gl-blend-func)
(import-method org.lwjgl.opengl.GL11 glDrawPixels gl-draw-pixels)
; A set of functions that generates Clojure code which in turn imports
; static methods from a class. Depends on importer.clj
(ns gltut.macro-generator
(:use [gltut.importer])
(:require [clojure.string :as s]
[clojure.java.io :as io])
(:import [org.lwjgl.opengl GL11 GL12 GL13 GL14 GL15 GL20 GL21 GL30 GL31 GL32
GL33 GL40 ]))
@flashingpumpkin
flashingpumpkin / importer.clj
Created January 5, 2012 21:42
Importing static methods / fields into defns and defs
(ns gltut.importer
(:import [java.lang.reflect Method Field]))
(defn get-methods
"Return all the methods on a class"
[#^Class cls]
(into [] (. cls getMethods)))
(defn get-fields
"Return all the fields on a class"
@flashingpumpkin
flashingpumpkin / ants.clj
Created December 27, 2011 18:00 — forked from michiakig/ants.clj
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@flashingpumpkin
flashingpumpkin / debug.clj
Created December 27, 2011 00:39 — forked from ato/debug.clj
Simpler debug-repl that works with unmodified Clojure
;; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html
(defmacro local-bindings
"Produces a map of the names of local bindings to their values."
[]
(let [symbols (map key @clojure.lang.Compiler/LOCAL_ENV)]
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))
(declare *locals*)
(defn eval-with-locals
;; add this to your ~/.emacs or ~/.emacs.d/init.el file
;; jump parens
(defun match-paren (arg)
(interactive "p")
(cond
((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
((looking-at "\\s\{") (forward-list 1) (backward-char 1))
((looking-at "\\s\}") (forward-char 1) (backward-list 1))
@flashingpumpkin
flashingpumpkin / default-app-recipe.rb
Created December 15, 2011 14:29
Pretty much what every python web dev should do when starting a new project
# Defaults that we'll need
include_recipe "apt"
package "vim"
package "screen"
package "git-core"
package "mercurial"
package "subversion"
package "python"
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@flashingpumpkin
flashingpumpkin / gmail.monospace.coffee.js
Created December 9, 2011 14:13
Gmail Monospace Font
css = """
div.Bk {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
textarea {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
td > div {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}