Skip to content

Instantly share code, notes, and snippets.

View lomholdt's full-sized avatar

Jonas Lomholdt lomholdt

View GitHub Profile
public <A, B> B foldLeft(List<A> l, B z, Function2<B, A, B> f) {
List list;
do {
if (Nil..MODULE$.equals((Object)(list = l))) {
B b = z;
return b;
}
if (!(list instanceof .colon.colon)) break;
.colon.colon colon2 = (.colon.colon)list;
Object h = colon2.head();
<?php
/**
* Use composers autoload class to load library files
*/
require_once '../vendor/autoload.php';
/**
* AdExchangeSeller Api class
*
@lomholdt
lomholdt / gist:52ae29a732ad139ff93901140e014cbb
Created June 13, 2017 07:11
Generate key and csr file for SSL certifikate
openssl req \
-newkey rsa:2048 -nodes -keyout domain.com.key \
-out domain.com.csr
@lomholdt
lomholdt / tmux-git.sh
Created October 9, 2017 21:15
Add git branch to tmux status bar
#!/bin/bash
# Current path
current_path="$(tmux display-message -p -F "#{pane_current_path}")"
# get the current branch
function get_branch {
value=$(cd $current_path; git rev-parse --abbrev-ref HEAD)
echo $value
}
@lomholdt
lomholdt / .tmux.conf
Last active October 10, 2017 13:21
Tmux conf
# remap prefix from 'C-b' to 'C-a'
# unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
######################
### DESIGN CHANGES ###
######################
# panes
@lomholdt
lomholdt / Directory.Build.targets
Created July 21, 2018 11:24 — forked from dasMulli/Directory.Build.targets
Allow `dotnet test` to be run from solution directory
<Project>
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>
</Project>
@lomholdt
lomholdt / example.cs
Created September 11, 2018 18:23
Overriden == operator
class Program
{
static void Main(string[] args)
{
var person1 = new Person("Jonas", "Lomholdt");
var personN = new Person("Jonas", "Lomholdt");
var person2 = new Person("Mike", "Tyson");
Person person3 = null;
// Show that comparing instances is working
@lomholdt
lomholdt / example.cs
Last active September 11, 2018 18:27
Overriden == operator
class Person
{
public string FirstName { get; private set; }
public string LastName { get; private set; }
public Person(string firstName, string lastName) => (FirstName, LastName) = (firstName, lastName);
public static bool operator ==(Person a, Person b)
{
@lomholdt
lomholdt / example.cs
Created September 11, 2018 18:28
Overriden == operator
if (person == null) {
throw new ArgumentNullException(nameof(person));
}
@lomholdt
lomholdt / example.cs
Created September 11, 2018 18:35
Overriden == operator
if (person is null) {
throw new ArgumentNullException(nameof(person));
}