Skip to content

Instantly share code, notes, and snippets.

View klemola's full-sized avatar

Matias Klemola klemola

View GitHub Profile
export const NotAsked: NotAsked = { type: "NotAsked" };
export const Loading: Loading = { type: "Loading" };
export const Success = <T>(data: T): Success<T> => ({
type: "Success",
data
});
export const Failure = <E>(error: E): Failure<E> => ({
type: "Failure",
error
});
import { RemoteData, Success, Failure, Loading } from "./RemoteData";
interface User {
username: string;
email: string;
}
export function main() {
let userRequest: RemoteData<User, Error> = Loading;
interface User {
username: string;
email: string;
}
export function main() {
let isLoading = true;
let fetchFailed = false;
let data: User;
/p/butsku-cli ./target/debug/butsku-cli status save (582ms)
Status saved
/p/butsku-cli ./target/debug/butsku-cli status list (258ms)
+------------+-------------------+----------------------------------+-----------------------------------------------------+
| Machine ID | Mac address | Timestamp | Meta |
+------------+-------------------+----------------------------------+-----------------------------------------------------+
| abel.local | A1:B2:12:1A:B2:C3 | 2019-05-09T15:52:30.379415+00:00 | Uptime: 18d 01h 11min, Load average: 2.13 1.93 1.84 |
+------------+-------------------+----------------------------------+-----------------------------------------------------+
@klemola
klemola / Main.elm
Last active January 9, 2017 15:26
Example of using elm-css in style tag
module Main exposing (..)
import Css.File
import MyCss
import Html exposing (div, text, node)
import Html.Attributes exposing (id, class)
css =
Css.File.compile [ MyCss.css ]
$('.approve').click();
window.setTimeout(function(){window.location.replace($('.prev_page')[0].href)}, 1000)