Skip to content

Instantly share code, notes, and snippets.

View cbilson's full-sized avatar

Chris Bilson cbilson

View GitHub Profile
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

Function WSUSUpdate {
$Criteria = "IsInstalled=0 and Type='Software'"
$Searcher = New-Object -ComObject Microsoft.Update.Searcher
try {
$SearchResult = $Searcher.Search($Criteria).Updates
if ($SearchResult.Count -eq 0) {
Write-Output "There are no applicable updates."
exit
}
else {
@codereflection
codereflection / CurrentThreadTaskScheduler.cs
Created December 20, 2013 20:04
Getting unit tests to run under a single thread. Just inherit the WithASingleThreadRestriction class from your unit tests and they'll run under a single thread making unit testing much easier.
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Tests
{
public class CurrentThreadTaskScheduler : TaskScheduler
{
protected override void QueueTask(Task task)
(defun nrepl-eval-expression-at-point-in-repl ()
(interactive)
(let ((form (nrepl-expression-at-point)))
;; Strip excess whitespace
(while (string-match "\\`\s+\\|\n+\\'" form)
(setq form (replace-match "" t t form)))
(set-buffer "*nrepl*")
(goto-char (point-max))
(insert form)
(nrepl-return)))
@jimwhite
jimwhite / Treasure.clj
Last active December 16, 2015 22:29
A Groovy and a Clojure solution for Google Code Jam practice Treasure [https://code.google.com/codejam/contest/2270488/dashboard#s=p3].
;; My first bit of Clojure.
;; https://code.google.com/codejam/contest/2270488/dashboard#s=p3
(def test_chests '({:name 1 :opener 1 :contents ()} {:name 2 :opener 1 :contents (1 3)} {:name 3 :opener 2 :contents ()} {:name 4 :opener 3 :contents (2)}))
(defn remove-first [pred lst]
(if (pred (first lst)) (rest lst) (cons (first lst) (remove-first pred (rest lst)))))
;; Return sequence of chest names to open all the chests starting with the given list (multiset) of keys.
;; Return nil if there is no combination that opens all the chests.
@stuarthalloway
stuarthalloway / gist:5199642
Created March 19, 2013 20:11
Draw a pedestal dataflow with dorothy + Graphviz
;; from leiningen, use [dorothy/dorothy "0.0.3"]
(require '[dorothy.core :as dot])
;; dataflow copied from chat
;; https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/behavior.clj
(def dataflow '{:transform
{:outbound {:init {} :fn outbound-transform}
:inbound {:init {} :fn inbound-transform}
:nickname {:init nil :fn nickname-transform}}
:effect {:outbound send-message-to-server}
@paxan
paxan / gist:3901864
Last active October 11, 2015 18:37
A Common Crawl Experiment (moved to https://github.com/paxan/ccooo)
@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@edubkendo
edubkendo / ctags_subl_coffee.md
Created June 9, 2012 15:11
Ctags, Sublime Text, Coffeescript

Ctags with Sublime Text and Coffeescript

Get Ctags

Step one is to install Exuberant Ctags on your system. For those on an Ubuntu system, this is as simple as:

sudo apt-get install ctags

Get the Sublime Text Plug-in

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#