Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
Process: itch [17240]
Path: /Applications/itch.app/Contents/MacOS/itch
Identifier: io.itch.mac
Version: 18.10.1 (18.10.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: itch [17240]
User ID: 501
Date/Time: 2016-10-23 21:56:40.220 +0100
@wjlroe
wjlroe / compile_error.txt
Created May 12, 2016 13:12
A Rust type error has me confounded
cargo build
Compiling piston_game v0.1.0 (file:///Users/will/Code/play/games/piston_game)
src/main.rs:17:19: 17:23 error: type mismatch resolving `<gfx_graphics::back_end::GfxGraphics<'_, gfx_device_gl::Resources, gfx_device_gl::command::CommandBuffer> as graphics::graphics::Graphics>::Texture == I`:
expected struct `gfx_texture::Texture`,
found type parameter [E0271]
src/main.rs:17 scene.draw(c.transform, g);
^~~~
src/main.rs:17:19: 17:23 help: run `rustc --explain E0271` to see a detailed explanation
error: aborting due to previous error
@wjlroe
wjlroe / fizzbuzz.rs
Last active May 2, 2016 21:54
FIZZBUZZ!!!
use std::fmt;
trait Fizzbuzzable {
fn next(&self) -> Box<Fizzbuzzable>;
fn string(&self) -> String;
}
struct A1(i64);
struct A2(i64);
struct A3(i64);
@wjlroe
wjlroe / emacs
Created February 25, 2016 01:31
; -*- mode: emacs-lisp; -*-
; vim:ft=lisp
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
(quote
@wjlroe
wjlroe / test-em-http.rb
Created August 23, 2013 11:00
How to stream a file download with em-http
require 'em-http'
require 'eventmachine'
url = ARGV[0]
puts "going to try to download #{url}"
EventMachine.run do
req = EventMachine::HttpRequest.new(url).get
File.unlink("really_big_file") if File.exist?("really_big_file")
@wjlroe
wjlroe / core.cljs
Last active December 21, 2015 08:48
After some core.async fun - this is a simple bit of event listening code for mouse and keyboard events. game.js is compiled from core.cljs
(ns chaotic-god.core
(:require [goog.dom :as dom]
[goog.Timer :as timer]
[goog.events :as events]
[goog.events.EventType :as event-type]
[goog.events.KeyCodes :as key-codes]
[chaotic-god.utils :as utils]
[cljs.core.async :refer [>! <! chan put! close! timeout]])
(:require-macros [cljs.core.async.macros :refer [go alt!]]))
class NullObject
def method_missing(*args, &block)
self
end
def nil?; true; end
end
def Maybe(value)
value.nil? ? NullObject.new : value
# HODOR
module.exports = (robot) ->
robot.hear /hodor/i, (msg) ->
msg.send "HODOR"
@wjlroe
wjlroe / some.clj
Last active December 17, 2015 00:29
Messing about with some-> in Clojure
user=> (def some-hash {:hello {:name "john" :aliases [{:text "woot"} {:name "lala"}]}})
#'user/some-hash
user=> (some-> some-hash :hello :name)
"john"
user=> (some-> some-hash :hello :age)
nil
user=> (some-> some-hash :byebye :name)
nil
user=> (some-> some-hash :hello :aliases first)
{:text "woot"}
@wjlroe
wjlroe / minimalism.html
Last active December 16, 2015 19:10
LimeJS rendering problem. No errors on the browser console. This is with LimeJS from master, revision e295e8898d382a4d9c60c558d8b0d14beffadd8e
<!DOCTYPE HTML>
<html>
<head>
<title>minimalism</title>
<script type="text/javascript" src="../closure/closure/goog/base.js"></script>
<script type="text/javascript" src="minimalism.js"></script>
</head>
<body onload="minimalism.start()"></body>