Skip to content

Instantly share code, notes, and snippets.

View hagbarddenstore's full-sized avatar

Kim Johansson hagbarddenstore

View GitHub Profile
@hagbarddenstore
hagbarddenstore / Books.txt
Last active September 12, 2020 09:34
A collection of computer science related books I've read throughout the years.
Clean Code: A handbook of agile software craftmanship
ISBN-13: 978-0132350884
The Clean Coder: A code of conduct for professional programmers
ISBN-13: 978-0137081073
Domain-Driven Design: Tackling complexity in the heart of software
ISBN-13: 978-0321125217
Patterns of Enterprise Application Architecture
[HttpPost]
public Model Get(int id)
{
var context = new TrineContext();
var investments = context.Investments.Where(i => i.Project_Id == id);
var projects = context.Projects.ToArray().Where(p => p.Id == id);
Expression<Func<Investment, bool>> c = i =>
i.Payment.State == PaymentState.Paid
|| i.Payment.State == PaymentState.PendingBankwire;
from __future__ import print_function
import json
import boto3
import os
def lambda_handler(event, context):
instance_id = event.get("detail", {}).get("instance-id", "")
if instance_id == "":
$ ansible-playbook test.yml
PLAY [localhost] ***************************************************************
TASK [debug] *******************************************************************
ok: [localhost] => {
"hosts": {
"correct": "{\"host\":\"127.0.0.1\"}",
"incorrect": {
"host": "127.0.0.1"
}
[Unit]
Description=Announce etcd node
[Service]
ExecStart=/bin/date
Type=simple
@hagbarddenstore
hagbarddenstore / s3-get.sh
Created July 14, 2015 20:38
A Bash script to retrieve a file stored on S3 via temporary IAM role credentials.
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: s3-get iam-role-name s3-resource output-file"
exit 1
fi
Role=$1
Resource=$2
@hagbarddenstore
hagbarddenstore / RoomObject.cs
Last active February 22, 2016 00:48 — forked from jrmoserbaltimore/RoomObject.cs
Horrendous code
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using BlackCore.GameWorld;
namespace BlackCore.GameWorld
{
public interface IRoom
{
IRoom SelectMode(Dictionary<string, int> mode, int state);
@hagbarddenstore
hagbarddenstore / ProjectStructure.cs
Created February 25, 2014 22:16
A simple project structure which separates business layer from the infrastructure layer and the application layer.
/**
* Solution
* |- Domain
* | `- Customers
* | |- Customer.cs
* | `- ICustomersRepository.cs
* |- Infrastructure
* | `- Customers
* | `- LinqToSqlCustomersRepository.cs
* `- Application
using System;
static class TimeKeeper
{
public static readonly Func<DateTime> DefaultTimeKeeper = () => DateTime.UtcNow;
private static readonly object LockObject = new object();
private static Func<DateTime> CurrentTimeKeeper = DefaultTimeKeeper;
@hagbarddenstore
hagbarddenstore / Doge-git.sh
Created January 10, 2014 12:44
Written by @chris__martin
#!/bin/sh
alias such = git
alias very = git
alias wow = 'git status'
# wow
# such commit
# very push