Skip to content

Instantly share code, notes, and snippets.

unsafe
{
byte** nativePackets = stackalloc byte*[packets.Length];
// Allocate native byte arrays.
for (int i = 0; i < packets.Length; i++)
{
nativePackets[i] = (byte *)Marshal.AllocHGlobal(packets[i].Length).ToPointer();
// TODO: try/finally, free memory allocated to date
}
public static Transport[] Convert(object list)
{
return Convert((object[])list);
}
// 1
public static Transport[] Convert(object[] list)
{
return list.Select<object, Transport>(o =>
{
diff --git a/relax.el b/relax.el
index 4d16beb..eddf99e 100644
--- a/relax.el
+++ b/relax.el
@@ -49,9 +49,10 @@
;;; Code:
+(require 'thingatpt)
(require 'url)
;;; Phil H's revised slime-project; can't remember where I found it
(defun slime-project (path)
"Setup classpaths for a clojure project and starts a new SLIME session.
Kills existing SLIME session, if any."
(interactive (list
(ido-read-directory-name
"Project root: "
(locate-dominating-file default-directory "pom.xml"))))
(when (get-buffer "*inferior-lisp*")
; A CLR port of http://bestinclass.wordpress.com/2009/09/24/chaos-theory-vs-clojure/
; Updated to use Rich Hickey's changes: http://paste.lisp.org/display/87799
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });
; A CLR port of Chouser's Christmas tree http://gist.github.com/40012
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });
; return Create(delegateType, fn);
; A CLR port of Brian's functional brain from
; http://blog.bestinclass.dk/index.php/2009/10/brians-functional-brain/
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires a ClojureCLR implmentation of futures and the following addition
; to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
(ns mrssxml
"Prints out an mrss xml playlist for a directory of mp3s.
Usage:
java -cp clojure-1.0.0.jar:clojure-contrib-1.0-compat.jar clojure.main \\
~/mrssxml.clj some-dir > playlist.xml"
(:use [clojure.contrib prxml])
(:require [clojure.contrib.str-utils2 :as s]
[clojure.contrib.java-utils :as java]
[clojure.contrib.command-line :as cl]))
#!/bin/bash
# A clj.sh that works on Windows in Cygwin. I just converted : to ; in the
# classpath.
#
# Sadly, you have to copy jars into
# your user clj dir; symlinks won't work with a win32 build of java.exe.
# Originally from http://gist.github.com/237162, and requires run.clj from there.
USER_CLJ_DIR=c:/Users/Shawn/.clojure