Skip to content

Instantly share code, notes, and snippets.

View cbilson's full-sized avatar

Chris Bilson cbilson

View GitHub Profile
@cbilson
cbilson / psake-compile.el
Created July 8, 2011 14:17
I want to use psake to compile things in emacs
(defun set-psake-compile-command ()
(interactive)
(let ((psake-file-dir (locate-dominating-file (buffer-file-name) "default.ps1")))
(if psake-file-dir
(let (( psake-command (concat "Set-Location " psake-file-dir "; & c:\\Dropbox\\bin\\psake.ps1")))
(progn
(make-local-variable 'compile-command)
(setq compile-command
(concat "powershell -NoProfile -ExecutionPolicy unrestricted -Command \"" psake-command "\"")))))))
@cbilson
cbilson / fastnav.el
Created June 23, 2011 19:56
My bastarded up fastnav - unfortunately the suggested key bindings conflict with paredit, so not using for now (until I can come up with a scheme that works for me)
;; fastnav.el -- Fast navigation and editing routines.
;;
;; Version 1.05
;;
;; Copyright (C) 2008, 2009, 2010 Zsolt Terek <[email protected]>
;;
;; Compatibility: GNU Emacs 22, 23.
;;
;; Inspired by zap-to-char, this library defines different routines operating on
;; the next/previous N'th occurrence of a character. When invoking one of these
;; I came up with this after reading http://stackoverflow.com/questions/1009037/processing-pairs-of-values-from-two-sequences-in-clojure
(defn nseq-map
"Given keys and sequences of values, produces a sequence of
maps of the keys to each slice of values from the sequences.
Example:
user> (nseq-map [:a :b :c] [1 2 3] [\"ba\" \"bb\" \"bc\"] [\"cx\" \"cy\" \"cz\"])
({:c \"cx\", :b \"ba\", :a 1} {:c \"cy\", :b \"bb\", :a 2} {:c \"cz\", :b \"bc\", :a 3})"
[keys & value-seqs]
cd 'C:\Program Files (x86)\Git\doc\git\html'; ls *.html | ?{$_.Name -match '\w+-\w+\.*'} | %{mv $_ $($_.Name.Replace('-', ''))}
Date,USDEUR
2010-07-02,1.2548
2010-07-01,1.2328
2010-06-30,1.2271
2010-06-29,1.2198
2010-06-28,1.2339
2010-06-25,1.2294
2010-06-24,1.2262
2010-06-23,1.2271
2010-06-22,1.2258
let ex (p : bool) =
if p then ignore()
else failwith "gusto"
let f () : unit =
ex false
(* stack trace doesn't include f's body. why? *)
f()
char[] GetDelimeters(string s)
{
return HasCustomTokens(s) ?
s.Substring(2, 1).ToCharArray()
: new char[] { ',', '\n' };
}
string GetValueToParse(string s)
{
return HasCustomTokens(s) ?
char[] GetDelimeters(string s)
{
if (s.StartsWith("//"))
return s.Substring(2, 1).ToCharArray();
else
return new char[] { ',', '\n' };
}
string GetValueToParse(string s)
{
// Adds the integers in a string like "1,2,3" = 6,
// or "//;\n1;2;3" = 6
public int Add(string value)
{
if (string.IsNullOrEmpty(value))
return 0;
var delimters = new char[] { ',', '\n' };
if (value.StartsWith("//"))
{
(*
Very ugly, very rough, very F# 101 <- my attempt to implement
STOMP [http://stomp.codehaus.org/Protocol].
This is the first time I've really tried using active patterns and
absolutely the first time I've used MailboxProcessors.
There are a couple of concepts I am still trying to work out:
1) What exactly happens with AsyncResponse's in mailboxes...I think I