Skip to content

Instantly share code, notes, and snippets.

View michiakig's full-sized avatar

aki michiakig

  • Rent the Runway
  • Brooklyn, NY
View GitHub Profile
@michiakig
michiakig / init.el
Created July 19, 2011 15:00
custom user file for emacs-starter-kit
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
;; use Mac command key for meta
(setq mac-command-modifier 'meta)
;; recursively add emacs dir to load-path
(let ((default-directory "~/.emacs.d/"))
(normal-top-level-add-subdirs-to-load-path))
@michiakig
michiakig / ants.clj
Created July 19, 2011 22:37
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
@michiakig
michiakig / init.el
Created July 20, 2011 17:27
minimal dotemacs for slime
;; SLIME
(add-to-list 'load-path "~/.emacs.d/slime")
(load "slime.el")
(eval-after-load "slime"
'(progn (slime-setup '(slime-repl))))
(eval-after-load 'slime '(setq slime-protocol-version 'ignore))
(require 'slime)
(slime-setup '(slime-scratch slime-editing-commands))
(setq inferior-lisp-program "sbcl") ; replace with your Common Lisp implementation
@michiakig
michiakig / three.cljs
Created August 19, 2011 20:53
three.js demo in ClojureScript
(ns three.demo)
(def camera (THREE.Camera. 75 (/ window/innerWidth
window/innerHeight) 1 10000))
(set! (.z (.position camera)) 1000)
(def scene (THREE.Scene.))
(def geometry (THREE.CubeGeometry. 200 200 200))
(def obj (js/Object.))
(set! (.color obj) 0xff0000)
(set! (.wireframe obj) true)
(def material (THREE.MeshBasicMaterial. obj))
@michiakig
michiakig / three.html
Created August 19, 2011 20:55
three.js demo in ClojureScript
<html>
<head></head>
<body>
<script type="text/javascript" src="Three.js"></script>
<script type="text/javascript" src="RequestAnimationFrame.js"></script>
<script type="text/javascript" src="output.js"></script>
</body>
</html>
@michiakig
michiakig / Foo.java
Created August 24, 2011 04:19
Java closures
public class Foo {
final int bar = 6;
final int[] flarp = new int[] {6};
public class Baz {
int bla() {
return bar;
}
int bloo() {
require 'RMagick'
import Magick
if(ARGV.length < 2)
puts "call with image filename and gcode filename"
exit(1)
end
XSTEP = 5
YSTEP = 5
;; set two global variables
(setq x 'global-x)
(setq y 'global-y)
;; define a function that returns a nested function
(defun return-a-nested-fn (x)
;; the nested function takes no arguments and returns a list of two values
(lambda () (list x y)))
;; call that function, and call the function returned
@michiakig
michiakig / threadpolicy.xml
Created November 19, 2012 20:26
CheckThread blog post threadpolicy.xml
<?xml version="1.0"?>
<threadpolicy version="1.0">
<class name="android.app.Activity">
<policy type="ThreadConfined" threadname="ThreadName.MAIN">
<method pattern="on.*" />
</policy>
</class>
<class pattern="android.*View">
<policy type="ThreadConfined" threadname="ThreadName.MAIN">
<method pattern=".*" />
@michiakig
michiakig / HackerNewsActivityV1Buggy.java
Created November 19, 2012 20:27
CheckThread blog post HackerNewsActivityV1Buggy.java
package com.flurry.example.hnreader;
import java.io.IOException;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;