Skip to content

Instantly share code, notes, and snippets.

View philcleveland's full-sized avatar

Phil Cleveland philcleveland

View GitHub Profile
@philcleveland
philcleveland / linux_setup.sh
Last active October 4, 2015 22:06
LinuxSetup Shell Script
echo ------------------------------------------------------------
echo --- installing curl
echo ------------------------------------------------------------
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup | sudo bash -
echo ------------------------------------------------------------
echo --- installing git
echo ------------------------------------------------------------
sudo apt-get install -y git
@philcleveland
philcleveland / rxcmd.snippet
Last active February 7, 2017 17:44
Xamarin ReactiveUI Snippets
public ReactiveCommand<$type$> $name$ { get; private set; }
@philcleveland
philcleveland / choco.bat
Last active September 10, 2015 20:46
Chocolatey Windows Box setup
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="googlechrome " />
<package id="notepadplusplus.install"/>
<package id="githubforwindows"/>
<package id="javaruntime"/>
<package id="7zip.install"/>
<package id="adobereader"/>
@philcleveland
philcleveland / DeleteIISExpressSites.ps1
Created December 5, 2014 20:24
Removes all IIS Express Sites
$appCmd = "C:\Program Files (x86)\IIS Express\appcmd.exe"
$result = Invoke-Command -Command {& $appCmd 'list' 'sites' '/text:SITE.NAME' }
for ($i=0; $i -lt $result.length; $i++)
{
Invoke-Command -Command {& $appCmd 'delete' 'site' $result[$i] }
}
@philcleveland
philcleveland / .gitattributes
Created December 3, 2014 16:47
Git Attributes to fix LF probs
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
<script>
function getStudyMetadata() {
var promise = $.ajax({
type: "GET",
url: "/study/metadata/{id}",
dataType: "json"
}).promise();
return Rx.Observable.fromPromise(promise);
};
@philcleveland
philcleveland / UnitOfMeasure.fs
Created November 15, 2014 17:25
Problem get UOM to work in the srm_color method
//ounce
//gallon
[<Measure>] type gal
//lovibond
[<Measure>] type L
//pounds
[<Measure>] type lbs
//gc = grain color
//weight = grain weight in lbs
@philcleveland
philcleveland / GameOfLife.fs
Created November 10, 2014 18:35
Game of life in F#
open System
open System.Threading
let printBoard (grid:int[,]) =
let maxX = (Array2D.length1 grid) - 1
let maxY = (Array2D.length2 grid) - 1
for row in 0 .. maxX do
for col in 0 .. maxY do
if(grid.[row,col] = 1) then printf "*|" else printf " |"
printfn ""
@philcleveland
philcleveland / mouseWheel.js
Last active August 29, 2015 14:07
Rx-js = mouseWheel handling
var canvasMouseOver = Rx.Observable.fromEvent(myCanvas, "mousedown");
var canvasMouseWheel = Rx.Observable.fromEvent(myCanvas, "mousewheel");
canvasMouseWheel.skipUntil(cavasMouseOver)
.subscribe(function (val) {
if (val.originalEvent.wheelDelta < 0) {
mainViewVM.incrementFrame();
}
else {
@philcleveland
philcleveland / HackBinding.txt
Created May 16, 2014 16:18
RxUI combobox hack binding
XAML
---------------------------------------------------------------
<ComboBox Grid.Row="0" x:Name="gardens" Margin="10" FontSize="24">
<ComboBoxItem>New...</ComboBoxItem>
<ComboBoxItem>G1</ComboBoxItem>
<ComboBoxItem>G2</ComboBoxItem>
<ComboBoxItem>G3</ComboBoxItem>
</ComboBox>