Skip to content

Instantly share code, notes, and snippets.

Anders Fjeldstad Hihaj

Block or report user

Report or block Hihaj

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
@Hihaj
Hihaj / kvantstrategier.md
Last active Sep 4, 2018
Kvantstrategier
View kvantstrategier.md

Kvantstrategier

#investering

Trendande värde

Screeningmetod

  1. Filtrera fram bolag med börsvärde >= 500 mkr, exkludera finansbolag (banker, investment, fastighet) samt ev. oönskade branscher (betting & spel).
  2. Filtrera bort bolag med där information saknas för nyckeltalen P/E, P/B, P/S, P/FCF, EV/EBITDA.
  3. Ersätt negativa värden med 100000 för nyckeltalen P/E, P/B, P/S, P/FCF, EV/EBITDA. (Detta för att inte enskilda dåliga värden ska få för stor inverkan på helheten.)
  4. Ranka bolagen på följande nyckeltal:
    • P/E (pris/vinst) - stigande
View keybase.md

Keybase proof

I hereby claim:

  • I am hihaj on github.
  • I am hihaj (https://keybase.io/hihaj) on keybase.
  • I have a public key ASAb8hcqj8zXB1t0q4LNP0GpP1xqiMWLQklP-qkZ098W5wo

To claim this, I am signing this object:

View microservice.js
const service, { sendCommand, query, publishEvent } = require('microservice');
const accountSuspensionService = service('account-suspension');
accountSuspensionService.onCommand('suspend-account', async function (command) {
const { id, reason } = command.payload;
const account = await query('get-account-by-id', { id });
if (account.status !== 'active') {
throw new Error(`Suspending an account requires status 'active', was instead '${account.status}'.`);
}
@Hihaj
Hihaj / index.html
Last active Oct 5, 2016
A practical choo app starter kit with ES2015 support and reasonably small bundle footprint.
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hello-choo</title>
</head>
<body>
<script src="static/bundle.js"></script>
</body>
</html>
@Hihaj
Hihaj / strip-non-printable-unicode-characters.js
Last active Jun 1, 2019
Removing all (or perhaps just "common") non-printable Unicode characters - except line breaks - from a string in JavaScript. (Adaptation of http://stackoverflow.com/questions/21284228/removing-control-characters-in-utf-8-string?lq=1)
View strip-non-printable-unicode-characters.js
const trimmed = problematicString.replace(/[\x00-\x09\x0B-\x0C\x0E-\x1F\x7F-\x9F]/g, '');
View Saga.cs
public abstract class Saga<TState> where TState : class
{
private const int MaxMessageHandlingRetryAttemptsPerMessage = 3;
private const int MillisecondsBetweenMessageHandlingAttempts = 500;
private readonly List<Func<IBus, string, Task>> _registrations = new List<Func<IBus, string, Task>>();
protected void When<TMessage>(
Func<TMessage, Task<IMemory>> accessMemory,
Func<TMessage, TState, Task<ITransformResult>> transform) where TMessage : class
View CustomerRevenueSaga.cs
public class CustomerRevenueSaga : Saga<CustomerRevenue>
{
public CustomerRevenueSaga(ICustomerRevenueStore store)
{
When<OrderPlaced>(
accessMemory: async msg => new Memory(await store.GetByCustomerId(msg.CustomerId), store.Save),
transform: (msg, state) =>
{
var nextState = state?.Clone() ?? new CustomerRevenue { CustomerId = msg.CustomerId };
nextState.PendingOrderAmounts[msg.Id] = msg.Amount;
View CustomerRevenueNode.cs
public class CustomerRevenueNode :
Node<CustomerRevenueNode.State>,
Node<CustomerRevenueNode.State>.IHandle<OrderPlaced>,
Node<CustomerRevenueNode.State>.IHandle<OrderCancelled>,
Node<CustomerRevenueNode.State>.IHandle<OrderDelivered>
{
public class State
{
public Guid CustomerId { get; set; }
public decimal AggregatedRevenue { get; set; }
View Node.cs
public interface INode
{
}
public interface IMessageToPublish
{
object Message { get; }
TimeSpan? Delay { get; }
}
View PipeExample.cs
interface IPipe
{
Type StateType { get; }
Type[] InputMessageTypes { get; }
IPipeOutput Transform(object message, object state);
}
public interface IPipeOutput
{
object[] Messages { get; }
You can’t perform that action at this time.