This file contains 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
defmodule Stack do | |
defstruct name: "", value: 0 | |
def init() do | |
_s = [] | |
end | |
def push(name, value, s) do | |
s_new = [%Stack{name: name, value: value}, s] | |
{:ok,s_new} |
This file contains 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
defmodule WinClip do | |
def write_to_clipboard(string_to_write) do | |
p = Port.open({:spawn,"clip"},[:stderr_to_stdout, :stream, :binary, :exit_status]) | |
Port.command(p,string_to_write) | |
Port.close(p) | |
end | |
end |
This file contains 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
Good Fonts: | |
Font Squirrel: http://www.fontsquirrel.com/ | |
Urban Fonts: http://www.urbanfonts.com/ | |
Google Web Fonts: http://www.google.com/fonts/ | |
Color Schemes: | |
Colour Lovers: http://www.colourlovers.com/ | |
Color Scheme Designer: http://colorschemedesigner.com/ | |
Image Color Picker: http://imagecolorpicker.com/ |
This file contains 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
#Two small, quick date utility functions. Convert a wxDateTime (from wxErlang) to a YYYYMMDD string. NB: assumes year is post 1000 CE. | |
defp wxDatetime_to_string({{year,month,day},{_hour,_minute,_second}}), do: "#{year}#{zero_padding(month,2)}#{zero_padding(day,2)}" | |
#Pad a string out with a specified number of leading zeroes. | |
defp zero_padding(string,len), do: String.rjust(to_string(string), len, ?0) |
This file contains 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
(* Borrowed very liberally from | |
https://blogs.msdn.com/b/jomo_fisher/archive/2010/03/06/neat-samples-f-freebase-and-dgml.aspx | |
and | |
http://cs.hubfs.net/forums/permalink/11096/11096/ShowThread.aspx#11096 | |
Many thanks to both those posters for giving me 99% of the starting code |
This file contains 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
// Copy/paste this into the FSI to see what it does. | |
open System | |
let a = [|"a";"b";"c";"d"|] | |
let randstring (arr:string[]) = | |
let r = new Random() | |
arr.[r.Next(arr.Length)] | |
let resultstring = randstring a;; |
This file contains 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
module measures | |
type ILinear = | |
interface | |
end | |
[<Measure>] type inch = |
This file contains 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
(* | |
* Filter a specified file into a second file | |
* Onorio Catenacci | |
* 21 October 2011 | |
*) | |
#r "System.dll" | |
open System.IO | |
//Remember: |
This file contains 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
#nowarn "62" | |
//Note this is running on Win7 x64 but git is 32 bit. | |
let pathEnvVar = "Path" | |
let gitBin = @"\Program Files (x86)\Git\bin" | |
let st2Bin = @"\Program Files\Sublime Text 2" | |
let currentPath = System.Environment.GetEnvironmentVariable(pathEnvVar) | |
let modifiedPath = gitBin ^ ";" ^ st2Bin ^ ";" ^ currentPath | |
System.Environment.SetEnvironmentVariable (pathEnvVar,modifiedPath) |
This file contains 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
#Adjust these values for your own installation. | |
Set-Variable -Name defaultDirectory -option Readonly -value "c:/mydev" | |
Set-Variable -Name defaultRepository -option Readonly -value "myrepo" | |
Set-Variable -Name defaultBranch -option Readonly -value "workbranch" | |
#Per "Everyday git-aliases", do a rebase as opposed to a merge | |
function gpurr($repository=$defaultRepository, $branch=$defaultBranch) | |
{ | |
& 'git' pull --rebase $repository $branch | |
} |
OlderNewer