This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Transport[] Convert(object list) | |
{ | |
return Convert((object[])list); | |
} | |
// 1 | |
public static Transport[] Convert(object[] list) | |
{ | |
return list.Select<object, Transport>(o => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- for (int i = resolutions.Length - 1; i >= 1; i--) | |
+ foreach (object[] resolution in resolutions.Skip(1).Cast<object[]>().Reverse()) | |
{ | |
- object[] resolution = (object[])resolutions[i]; | |
- List<Transport> ret = new List<Transport>(); | |
- return ((object[])list).Select<object, Transport>(o => | |
- { | |
- object[] transport = o as object[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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) | |
; { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer