Skip to content

Instantly share code, notes, and snippets.

View stuartwakefield's full-sized avatar

Stuart Wakefield stuartwakefield

View GitHub Profile
@stuartwakefield
stuartwakefield / clojure.bat
Last active December 13, 2015 17:28
Just the batch file I use to run clojure nicely on my Windows command line
:: Installation
:: ------------
::
:: 1. Add this to your Clojure directory.
:: 2. Add that directory to your Windows PATH
:: 3. Change the version number in the Batch file if need be.
::
:: Then you can run clojure from the Windows command line just by typing:
::
:: clojure [args]
@stuartwakefield
stuartwakefield / lein.bat
Last active December 13, 2015 18:08
Just the batch file I use to run Leiningen on my Windows system
:: Installation
:: ------------
::
:: 1. Download the latest Leiningen Jar file
:: 2. Place it somewhere useful, mine is in my clojure directory
:: 3. Make sure that directory is on the Windows PATH
:: 4. Change the version number if you need to
::
:: Then you can run Leiningen from the Windows command line just by typing:
::
@stuartwakefield
stuartwakefield / compiler.bat
Created March 18, 2013 11:02
Just the batch file I use to run Google Closure Compiler
:: Installation
:: ------------
::
:: 1. Add this to the same directory as the Google Closure Compiler jar
:: 2. Add that directory to your Windows PATH environment variable
::
:: Then simply run the compiler, for example:
::
:: compiler --js input.js --js_output_file output.min.js
::
@stuartwakefield
stuartwakefield / logproc.bat
Last active December 15, 2015 03:39
Starting to log processes for my Win PC
:: Put this somewhere sensible open up the Task Scheduler create a new
:: task to run this batch file on a regular interval
@echo off
set DIRPATH=%~dp0
:: Create a timestamp for the file
set TS=%date:~-4,4%%date:~-7,2%%date:~-10,2%-%time:~0,2%%time:~3,2%%time:~6,2%-%time:~9,2%
:: Create the log directory if it doesn't exist
@stuartwakefield
stuartwakefield / reindent.js
Last active December 15, 2015 10:29
Converts silly space indenting into tab indenting. Begin rant... The whole use spaces and not tabs brigade infuriates me. A tab can be displayed based on the developers preferences, whereas spaces cannot. Space indentation can be handled automatically by your editor but very few editors support automatic removal of space indentation. Indentation…
var reindent = {
/**
* This function converts space indentation to tabs
* @param input the input to cleanse
* @param n the number of spaces used to indent
* @returns the cleansed output
*/
spacesToTabs: function(input, n) {
var regexp = new RegExp("[^\\S\\r\\n\\t]{" + n + "," + n + "}", "g");
@stuartwakefield
stuartwakefield / aptana.desktop
Last active December 15, 2015 18:59
A desktop entry for Aptana, when you unzip the Aptana directory move the contents to /usr/bin/aptana
[Desktop Entry]
Type=Application
Name=Aptana Studio 3
Version=3.3.2
GenericName=Integrated Development Environment
Comment=Build web applications quickly and easily
Exec=/usr/bin/aptana/AptanaStudio3
Icon=/usr/bin/aptana/icon.xpm
@stuartwakefield
stuartwakefield / color.js
Last active December 16, 2015 19:59
Some color functions
/**
* Given an integer representing the hexadecimal
* value for a color, returns an array containing
* the RGB values from 0 to 255
* @param val the integer representing the color
* @returns the array of RGB values
*/
function toRGB(val) {
var r = (val & 0xFF0000) >>> 16;
var g = (val & 0x00FF00) >>> 8;
@stuartwakefield
stuartwakefield / AddConfShellNew.reg
Last active December 17, 2015 05:48
Batch script for updating my context menu "New" items
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.conf]
@="NotePadPP.conf"
[HKEY_CLASSES_ROOT\.conf\ShellNew]
"NullFile"=""
[HKEY_CLASSES_ROOT\NotePadPP.conf]
@="Configuration File"
@stuartwakefield
stuartwakefield / clojure.reg
Created May 23, 2013 16:03
Registry keys to run clojure .clj scripts without specifying the clojure
Windows Registry Editor Version 5.00
; Make clj runnable by clojure
[HKEY_CLASSES_ROOT\.clj]
@="ClojureScript"
[HKEY_CLASSES_ROOT\ClojureScript]
@="Clojure Script"
[HKEY_CLASSES_ROOT\ClojureScript\shell\open\command]
@="java -jar \path\to\clojure.jar %1"
@stuartwakefield
stuartwakefield / fibseq.clj
Last active December 24, 2015 15:09
A method to create a Fibonnaci sequence
(defn fibseq [n]
((fn inner [acc m]
(if (= m 0)
acc
(inner (conj acc (+
(if (< (count acc) 2)
0 (get acc (- n m 2)))
(if (< (count acc) 1)
1 (get acc (- n m 1))))) (- m 1)))) [ ] n))