Skip to content

Instantly share code, notes, and snippets.

View jmglov's full-sized avatar

Josh Glover jmglov

View GitHub Profile
@jmglov
jmglov / audio-feedback.patch
Created June 27, 2012 16:43
add audio feedback to button clicks
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index e391302..0f6aea2 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -55,6 +55,19 @@ target_link_libraries(adonthell_gui
adonthell_rpg
)
+################################
+# Unit tests
@jmglov
jmglov / gist:c8cf2ef268dede96ca69
Created February 25, 2015 16:58
Amazon Mobile Analytics client for Unity, WIP
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Xml.Serialization;
using UnityEngine;
@jmglov
jmglov / drawing-shark.clj
Created September 24, 2015 16:33
Kai's clj4kids shark drawing
[[:black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black] [:black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black] [:black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black] [:black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :black :
#include <stdio.h>
#include <stdlib.h>
#include <libavformat/avformat.h>
#include <libavutil/channel_layout.h>
#include <libavutil/error.h>
#include <libavutil/avstring.h>
#include <libswscale/swscale.h>
@jmglov
jmglov / cli.pxi
Created December 10, 2015 09:41
Basic command-line arguments parser for Pixie
#!/usr/bin/env pxi
(ns cli
"pxi cli.pxi --verbose --bar 42 --hello 'world!'
{:verbose true, :bar 42, :hello world!}"
(:require [pixie.string :as string]))
(defn- arg?
"Returns true if the string is an argument to an option"
[s]
@jmglov
jmglov / http-client.pxi
Created December 10, 2015 16:14
Basic HTTP client for Pixie (only does GET)
(ns http-client
"Example: (http-client/GET \"54.225.205.17\" \"jsonplaceholder.typicode.com\" \"/posts/1\")"
(:require [pixie.io :as io]
[pixie.io.tcp :as tcp]
[pixie.streams :as stream]
[pixie.string :as string]))
(def CR 13)
(def LF 10)
@jmglov
jmglov / config.ex
Created May 18, 2016 11:53
Elixir: override Mix config with environment variables
defmodule Config do
defmacro __using__(_) do
quote do
import unquote(__MODULE__), only: :macros
end
end
defmacro cfg(key, type \\ :string) do
quote do
defp unquote(key)() do
@jmglov
jmglov / foo.ex
Created May 18, 2016 12:06
Example usage for config.ex
defmodule Foo do
use Config
cfg :disable_foo?, :boolean
cfg :bar_delay, :integer
cfg :baz_name
cfg :blahs, {:list, :float}
cfg :blerks, {:set, :atom}
def print_stuff do
@jmglov
jmglov / init.el
Last active February 19, 2017 03:33
Emacs configuration for Clojure development
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa.org" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
@jmglov
jmglov / ping_pong.clj
Created July 6, 2016 10:38
Ping-pong game with core.async
(ns ping-pong
(:require [clojure.core.async :as async :refer [<!! >!!]]))
(defn ping [ch]
(println "Ping")
(>!! ch :ping)
(<!! (async/timeout 500)))
(defn pong [ch]
(println "Pong")