Skip to content

Instantly share code, notes, and snippets.

View oleersoy's full-sized avatar

Ole Ersoy oleersoy

  • Firefly Semantics Corporation
  • Chicago
View GitHub Profile
<div class="Grid Grid--withGutter">
<div class="u-md-size1of2 u-lg-size1of4">
<div class="TestBox">1</div>
</div>
<div class="u-md-size1of2 u-lg-size1of4 ">
<div class="TestBox u-border-top-style-none u-md-border-top-style-solid">2</div>
</div>
<div class="u-md-size1of2 u-lg-size1of4">
<div class="TestBox u-border-top-style-none u-lg-border-top-style-solid">3</div>
</div>
/**
* Calcluates profit score. The formula is:
* `profit * probability`
*
* @param profit
* @param probability
* @throws IsError with error code
* FS__SERVICE_PARTS_BUSINESS__PROFIT_NOT_POSITIVE
* if the `profit` parameter is less than zero.
* @throws IsError with error code
/**
* Calculates the marginal units fulfilled
*
* The formula is `currentNumberOfFills - previousNumberOfFills`.
*
* The current number of fills corresponds to the current stocking level.
* Thus if the current stocking level is 2, then the previous stocking level
* was 1. The previous number of fills would then be the result of a
* stocking level of 1.
*
export class Order {
public readonly sku;
public readonly quantity;
public readonly price;
public readonly total;
constructor(builder:OrderBuilder) {
this.sku = builder.sku;
this.quantity = builder.quantity;
this.price = builder.price;
this.total = builder.total;
@import "./license";
@import "./responsive";
@import "@superflycss/variables-dimension";
:root {
--display-size-0: 2.5rem;
--display-size-50: 3.0rem;
--display-size-100: 3.5rem;
--display-size-200: 4.0rem;
--display-size-300: 4.5rem;
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="200" height="200" version="1.1" viewBox="0 0 52.917 52.917" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
<svg class="Square" version="1.1" viewBox="0 0 52.917 52.917" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<g transform="translate(0 -244.08)">
<rect y="244.08" width="52.917" height="52.917"/>
</g>
</svg>
@oleersoy
oleersoy / index.d.ts
Created May 29, 2019 14:54
Papaparse
// Type definitions for PapaParse v4.5
// Project: https://github.com/mholt/PapaParse
// Definitions by: Pedro Flemming <https://github.com/torpedro>
// Rain Shen <https://github.com/rainshen49>
// João Loff <https://github.com/jfloff>
// John Reilly <https://github.com/johnnyreilly>
// Alberto Restifo <https://github.com/albertorestifo>
// Behind The Math <https://github.com/BehindTheMath>
// 3af <https://github.com/3af>
// Janne Liuhtonen <https://github.com/jliuhtonen>
@oleersoy
oleersoy / index.ts
Created June 23, 2019 20:41
purchaseorder
/**
* Calculate the average purchase cost for the array of {@link PurchaseOrder}
* instances.
*
* @param purchaseOrders
*/
export function calculateAveragePurchaseCost(purchaseOrders:Partial<PurchaseOrder>[]):number {
return (average(
purchaseOrders
.map(po => po.purchaseCost)
import { calculateAveragePurchaseCost } from './';
it('should calculate the average purchase cost', ()=>{
let po1 = { sku: 'sk123', purchaseCost: 30000};
let po2 = { sku: 'sk223', purchaseCost: 60000};
let pos = [po1, po2];
let averagePurchaseCost = calculateAveragePurchaseCost(pos);
expect(averagePurchaseCost).toEqual(45000);
});