######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.
######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.
| public static SharedResource Instance { get; } = new SharedResource(); | |
| private SharedResource() {} |
| //------------------------------- 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} |
| <!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> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <!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> |
| # 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 |