Skip to content

Instantly share code, notes, and snippets.

Michał Łusiak mlusiak

Block or report user

Report or block mlusiak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View math.ex
defmodule Flightlog.Math do
def greatCircle(a,b) do
lat1 = elem(a, 0)
lon1 = elem(a, 1)
lat2 = elem(b, 0)
lon2 = elem(b, 1)
rlat1 = :math.pi * lat1 / 180.0
rlat2 = :math.pi * lat2 / 180.0
theta = lon1 - lon2
View flight_view.ex
defmodule Flightlog.FlightView do
use Flightlog.Web, :view
def download(airport) do
url = "https://airportapi02560c297e8.azurewebsites.net/api/Airports?code=gEjAp7qIbRDJRJYFYxcgZ1bl1sqCPaTBPsZLVxy5MGHRNFEU79etKw==&iataCode=" <> airport
response = HTTPotion.get url
{status, fields} = JSON.decode(response.body)
fields
end
View test.js
var beacon = require('beacon-pie');
console.log("Wait for the UART to initialize");
setTimeout(function() {
    console.log("UART should be ready by now");
    // setting first advertiser with power 4db, 400ms interval, Local Name "Test"
    beacon.setAdvertisingPacket(14400"Test");
    // same settings for 2nd advetiser, with bigger granularity
View run.fsx
#r "System.Net.Http"
#r "Newtonsoft.Json"
open System.Net
open System.Net.Http
open Newtonsoft.Json
type Airport = {
iata: string;
country: string;
View show.html.eex
<h2>Show flight</h2>
<ul>
<li>
<strong>Date:</strong>
<%= @flight.date %>
</li>
<li>
View flight_view.ex
defmodule Flightlog.FlightView do
use Flightlog.Web, :view
def download(airport) do
url = "https://airportapi02560c297e8.azurewebsites.net/api/Airports?code={not_that_important}&iataCode=" <> airport
response = HTTPotion.get url
{status, fields} = JSON.decode(response.body)
fields
end
View show.html.eex
<li>
<strong>Plane Type</strong>
<%= @flight.plane_type %>
</li>
@mlusiak
mlusiak / show.html.eex
Created Mar 21, 2017
Elixir Template 2
View show.html.eex
<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 %>
@mlusiak
mlusiak / index.html.eex
Created Mar 21, 2017
Elixir Template #1
View index.html.eex
<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>
View keybase.md

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:

You can’t perform that action at this time.