Skip to content

Instantly share code, notes, and snippets.

@mlusiak
mlusiak / gist:3969505
Created October 28, 2012 19:09
Zombify install error
PM> Install-Package Zombify -Version 0.0.3
Install failed. Rolling back...
Install-Package : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and th
e directory name must be less than 248 characters.
At line:1 char:16
+ Install-Package <<<< Zombify -Version 0.0.3
+ CategoryInfo : NotSpecified: (:) [Install-Package], PathTooLongException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
@mlusiak
mlusiak / getJson.fs
Last active December 30, 2015 23:39
Getting Json from bitstamp.net API and parsing it with Json Type Provider
let getHttp (url: string) =
let req = System.Net.WebRequest.Create(url)
let resp = req.GetResponse()
let stream = resp.GetResponseStream()
let reader = new StreamReader(stream)
let html = reader.ReadToEnd()
resp.Close()
html
type Bitstamp = JsonProvider<""" {"high": "844.00", "last": "714.33", "timestamp": "1386459953", "bid": "713.10", "volume": "81293.11654151", "low": "542.38", "ask": "713.88"} """>
@mlusiak
mlusiak / 1-redis-wrong.fs
Last active December 30, 2015 23:39
Saving some stuff into redis
type BitstampLast = {Id:int64; Timestamp:int; Value:decimal}
let redis = new RedisClient("localhost")
redis.FlushAll()
let redisBitstamp = redis.As<BitstampLast>()
let cp = currentPrice()
let last = {Id = redisBitstamp.GetNextSequence(); Timestamp = fst cp; Value = snd cp}
let stored = redisBitstamp.Store(last)
@mlusiak
mlusiak / redis-read.fs
Created December 11, 2013 00:34
Read stuff from redis
[<CLIMutable>]
type BitstampLast = {Id:int64; Timestamp:int; Value:decimal}
let redis = new RedisClient("localhost")
let redisBitstamp = redis.As<BitstampLast>()
let allValues = redisBitstamp.GetAll()
@mlusiak
mlusiak / chart.fs
Created December 11, 2013 00:36
Charting data
[for v in allValues -> (v.Timestamp, v.Value)]
|> Chart.Line
|> Chart.WithYAxis(Min = 950.0, Max = 1000.0)
@mlusiak
mlusiak / redis-complete.fs
Created December 11, 2013 01:40
Putting it all together - get data, save to redis, read back, chart
#if INTERACTIVE
#r "bin/Debug/FSharp.Data.dll"
#r "bin/Debug/FSharp.Charting.dll"
#r "bin/Debug/ServiceStack.Common.dll"
#r "bin/Debug/ServiceStack.Interfaces.dll"
#r "bin/Debug/ServiceStack.Text.dll"
#r "bin/Debug/ServiceStack.Redis.dll"
#load "../packages/FSharp.Charting.0.90.5/FSharp.Charting.fsx"
#endif
open System.IO

Keybase proof

I hereby claim:

  • I am mlusiak on github.
  • I am mlusiak (https://keybase.io/mlusiak) on keybase.
  • I have a public key whose fingerprint is 500B 307D AEE1 58FA 3C6A E7F7 17D4 DDC7 607B C767

To claim this, I am signing this object:

@mlusiak
mlusiak / index.html.eex
Created March 21, 2017 23:07
Elixir Template #1
<div class="jumbotron">
<h2>List of flights</h2>
<table>
<tr><th>Date</th><th>Flight Number</th><th>Details</th></tr>
<tr><th>13.03.2017</th><th>SK753</th><th><a href="/flights/1">-></a></th></tr>
</table>
</div>
@mlusiak
mlusiak / show.html.eex
Created March 21, 2017 23:08
Elixir Template 2
<div class="jumbotron">
<h2>Flight details</h2>
<%= if @id=="1" do %>
<strong>Date:</strong> 13.03.2017</br>
<strong>Flight Number:</strong>SK 753</br>
<strong>From:</strong> CPH</br>
<strong>To:</strong> GDN</br>
<% else %>
No information about flight <%= @id %> ;( !
<% end %>
<li>
<strong>Plane Type</strong>
<%= @flight.plane_type %>
</li>