Skip to content

Instantly share code, notes, and snippets.

class Result
{
public $value;
public $error;
private function __construct($value, $error = null)
{
$this->value = $value;
$this->error = $error;
}
@piotrMocz
piotrMocz / zdroweapi.ipynb
Last active March 15, 2018 11:09
Zdrowe API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@piotrMocz
piotrMocz / Main.hs
Created February 7, 2018 14:10
Testing the performance of populating a Vector in Haskell
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module Main where
import Prelude as P
import Criterion.Main
import Control.DeepSeq
import Data.Monoids
@piotrMocz
piotrMocz / benchmark.c
Last active February 7, 2018 14:50
Testing the performance of populating an array with structs.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10000000
typedef struct _Foo {
int name, id;
} Foo;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@piotrMocz
piotrMocz / Type.scala
Created July 18, 2016 19:24
New type hierarchy for scalajs_java
package scalajs_java.trees
sealed trait Type
// Type of statements
case object NoType extends Type
// Primitive types
@piotrMocz
piotrMocz / Main.scala
Created October 31, 2015 20:51
Reactive lab 3
/**
* Created by moczur on 10/19/15.
*/
import akka.event.LoggingReceive
import akka.actor._
import scala.concurrent.duration._
import scala.util.Random
import language.postfixOps
@piotrMocz
piotrMocz / buctrap_trusty.sh
Created September 6, 2015 17:37
Install ghc on ubuntu
# Disclaimer: work-in-progress-kind-of-thing, really more of a dockerfile-became-shellscript
# Installs emulated arm ghc on amd64 box
# It assumes you're running Ubuntu 14.04 (Trusty)
# Oh btw -- run with sudo
# from Alexey Raga's dockerfile (to stop apt from asking you for a "yes"):
export DEBIAN_FRONTEND=noninteractive
export OPTS_APT="-y --force-yes --no-install-recommends"
apt-get update
@piotrMocz
piotrMocz / sources.list
Last active October 7, 2023 03:55
/etc/apt/sources.list file for arm cross-compilation under amd64
# sources.list file for arm cross-development under amd64
#deb [arch=amd64] cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
deb [arch=armhf] http://ports.ubuntu.com/ trusty main restricted universe multiverse
deb [arch=armhf] http://ports.ubuntu.com/ trusty-security main restricted universe multiverse
deb [arch=armhf] http://ports.ubuntu.com/ trusty-updates main restricted universe multiverse
deb [arch=armhf] http://ports.ubuntu.com/ trusty-backports main restricted universe multiverse
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
@piotrMocz
piotrMocz / Slajs.java
Created May 19, 2015 07:54
Ice ice baby.
public class NewsReceiver extends _FinancialNewsReceiverDisp {
private static final long serialVersionUID = -3538248252658050588L;
public static HashMap<CurrencyPair, Float> exchangeRates = new HashMap<>();
public static HashMap<Currency, Float> interestRates = new HashMap<>();
@Override
public void interestRate(float rate, Currency curr, Current __current) {
interestRates.put(curr, rate);