Skip to content

Instantly share code, notes, and snippets.

View ideaflare's full-sized avatar

Christoph ideaflare

View GitHub Profile
@ideaflare
ideaflare / AgileWisdom.md
Last active October 23, 2015 09:17 — forked from chasingbob/AgileWisdom.md
Agile Wisdom

######DeveloperUG 13 October 2015

######Paul:

###Balance Love what you do

###Communication Choose your medium - you do not write in the same style on slack/skype than how you would in a formal e-mail.

@ideaflare
ideaflare / cs6Singleton.cs
Created January 22, 2016 13:56
Singleton pattern in C# 6
public static SharedResource Instance { get; } = new SharedResource();
private SharedResource() {}
@ideaflare
ideaflare / NeuralNet.fsx
Last active May 19, 2016 10:48
Basic Feed-Forward Neural network in F#, tested with crude random search training to generalize XOR.
//------------------------------- Create Network -------------------------------
type Neuron = { Weights : float list ; Bias : float }
type Layer = { Neurons : Neuron list }
type Network = { Layers : Layer list }
let rnd = System.Random()
let randomWeight _ = (2.0 * rnd.NextDouble()) - 1.0
let buildNeuron inputs =
// arrange some guinea pig for testing
class Sheep
{
// public get & set used to read/write values
public string Name { get; set; }
public IceCream FavouriteIceCream { get; set; }
}
enum IceCream
{
Vanilla,
// Add NuGet package FSharp.Data
#r "../packages/FSharp.Data.2.3.2/lib/net40/FSharp.Data.dll" //#r is needed in .fsx file. You can omit this line in .fs file.
open FSharp.Data
let apiUrl = "http://swapi.co/api/people/?format=json"
type People = JsonProvider<"http://swapi.co/api/people/?format=json">
type Planet = JsonProvider<"http://swapi.co/api/planets/1/"> // * planet was found by inspecting....
// assumption made, all planets have the same json structure/properties as planet #1
type Color = Red | Green | Ivory | Yellow | Blue
type Nation = England | Spain | Ukrane | Norway | Japan
type Pet = Dog | Snail | Fox | Horse | Zebra
type Drink = Coffee | Tea | Milk | Juice | Water
type Smoke = OldGold | Kools | Chester | Lucky | Parliaments
// who drinks water? who owns the zebra ?
type House = {color: Color; nation: Nation; pet: Pet; drink: Drink; smoke: Smoke}
@ideaflare
ideaflare / ArgumentCheck.html
Last active June 30, 2017 17:38
Check that all arguments are present: function unspecified(args) {..}
<!DOCTYPE html>
<html>
<body>
<p>Finding the sum of numbers.</p>
<p>Sum() returns <span id="demo-no-arguments"></span></p>
<p>Sum(32) returns <span id="demo-32"></span></p>
<p>Sum(1,2,3,4,5) returns <span id="demo-1-to-5"></span></p>
<script>
@ideaflare
ideaflare / introrx.md
Created July 11, 2017 17:55 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ideaflare
ideaflare / CustomElementWithStyle.html
Created July 21, 2017 21:01
Create custom element and style it.
<!DOCTYPE html>
<html>
<body>
<div id="container" style="padding: 20px; border: 1px dashed grey;">
<div>Don't replace this.</div>
<custom-button></custom-button>
<div>Don't replace this either.</div>
</div>
@ideaflare
ideaflare / .bashrc
Created September 2, 2017 19:34
Useful bashrc additions
# Delete
slice() {
if [ $# -eq 0 ]
then
echo "No arguments supplied"
else
read -p "Sure you want to : shred -vzu $1? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then