Skip to content

Instantly share code, notes, and snippets.

View avescodes's full-sized avatar

Avery Quinn avescodes

View GitHub Profile
Verifying that +rkneufeld is my blockchain ID. https://onename.com/rkneufeld
@avescodes
avescodes / java_interop.md
Created December 20, 2013 19:57
java_interop.md

Type Hints

Aliases

Clojure provides aliases for a large number of built-in Java types. For example, you can hint an Integer with ^int instead of ^Integer. This is particularly useful for arrays, whose class names contain special characters (e.g. the type of (int-array []) is [I).

@avescodes
avescodes / metadata.md
Last active December 31, 2015 23:29
Short-hands section for clojure.org/metadata

Short-hands

In addition to with-meta, there are a number of short-hand reader macros for affixing metadata to objects.

  • ^{:doc "How obj works!"} obj - Sets the metadata of obj to the provided map. Equivalent to (with-meta obj {:doc "How obj works!"}).
  • ^:dynamic obj - Sets the given keyword to true in the object's metadata. Equivalent to ^{:dynamic true} obj.
@avescodes
avescodes / project.clj
Created September 4, 2013 15:20
User.clj is evaluated three times when :source-paths and [:repl-options :init-ns] are specified
(defproject usertwice "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]]
:source-paths ["."]
:repl-options {:init-ns user})
@avescodes
avescodes / .tmux.conf
Created May 10, 2013 14:48
Tmux it up
set -g default-terminal "xterm-256color" # More colors
set-option -g xterm-keys on # Work more nicely with odd key combos (emacs)
set -g base-index 1 # Tabs start at '1', not '0'
set -s escape-time 0 # Faster activation
# Bind <C-q> to leader
# Make sure to update status-right to include your leader!
unbind C-b
set -g prefix C-q
bind-key q send-prefix
@avescodes
avescodes / upsearch.sh
Created January 4, 2013 16:48 — forked from anonymous/upsearch.sh
Recursively search upwards for a directory or file.
upsearch () {
if test -e "$1"; then
echo "$PWD"
else
if [ "$PWD" = "/" ]; then
return 1;
else
pushd .. > /dev/null
upsearch "$1"
exit_status=$?
;; Add more parens with wrap! M-(
(+ 1 * 2 3) ; -> (+ 1 (*) 2 3)
;; Slurp
;; To the right with C-right
(+ 1 (*) 2 3) ; -> (+ 1 (* 2) 3)
;; To the left with C-M-left
(+ 1 (*) 2 3) ; -> (+ (1 *) 2 3)
;; and Barf
<script type="text/javascript">
var queueBytesLoaded = 0;
var queueBytesTotal = 0;
var myQueue = null;
var queueChangeHandler = function(queue){
// alert('Uploading Started');
myQueue = queue;
// console.log("COLLECTION CHANGE!");
var list = document.getElementById('file_todo_list');
@avescodes
avescodes / your-project-test.js
Created April 29, 2012 19:44
Sample npm mocha test
var mocha = require('mocha');
var expect = require('chai').expect;
describe("My project", function () {
it("should know its version", function () {
var myProject = require('../index');
expect(myProject.version).to.not.equal(undefined);
expect(myProject.version).to.equal('0.0.0');
});
});
In the language of your choice write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".