Skip to content

Instantly share code, notes, and snippets.

View frne's full-sized avatar

Frank Neff frne

View GitHub Profile
@frne
frne / option.ts
Created February 8, 2024 08:59
Function TS Option type
export abstract class Option<T> {
protected value: T | null;
static of<T>(value: T | null): Option<T> {
if (value == null) {
return new None();
} else {
return new Some(value);
}
}
@frne
frne / BankHolidays.kt
Created January 26, 2023 11:15
Example implementation of Swiss Bank Holidays in Kotlin
import BankHoliday.Companion.isBankHoliday
import java.time.LocalDate
import java.time.Year
fun main(args: Array<String>) {
// some tests (should be done using JUnit of course ;)
mapOf(
LocalDate.of(2023, 1, 1) to true,
LocalDate.of(2023, 8, 1) to true,
@frne
frne / Schema2CaseClass.scala
Last active May 6, 2022 20:23
Spark DataFrame Schema to Scala Case Class Generator
object Schema2CaseClass {
import org.apache.spark.sql.types._
case class RecFieldRes(fieldStr: String, additionalCc: Option[String] = None)
case class CcRes(cc: String, additional: List[String])
def schema2Cc(schema: StructType, className: String): String = {
val res = CcRes(s"case class $className (\n", Nil)
@frne
frne / 90-rat.conf
Last active December 12, 2016 17:48
XUBUNTU ob MacBook Pro
# path: /usr/share/X11/xorg.conf.d/90-rat.conf
Section "InputClass"
Identifier "Mouse Remap"
MatchDevicePath "/dev/input/event*"
MatchProduct "Mad Catz Mad Catz R.A.T.7 Mouse"
Option "AutoReleaseButtons" "13 14 15"
Option "Buttons" "17"
Option "YAxisMapping" "10 11"
Option "ZAxisMapping" "4 5 6 7"
Option "Emulate3Buttons" "no"
@frne
frne / keybase.md
Last active October 31, 2018 21:33
keybase.md

Keybase proof

I hereby claim:

  • I am frne on github.
  • I am frne (https://keybase.io/frne) on keybase.
  • I have a public key ASBn48xpd_mqiMLeCT7B3iVP6DtqwE0fMOdLUqcONp_8UAo

To claim this, I am signing this object:

@frne
frne / AwsPredictionEngine.scala
Last active March 20, 2016 12:31
Code Samples - twitterist.org API
package service
import com.amazonaws.services.machinelearning.model.PredictRequest
import model.FeatureSet
import service.util.{AwsMachineLearningServiceProvider, Loggable}
import scala.collection.JavaConverters._
/** Implementation of the [[service.PredictionEngine]] service */
class AwsPredictionEngine extends PredictionEngine with Loggable with AwsMachineLearningServiceProvider {
@frne
frne / ._readme.md
Last active May 7, 2021 17:06
Fancy Colors for (OSX-) Bash

Fancy Colors for (OSX-) Bash

Fancy console screenshot

Prerequisites

Git contrib-scripts and grc

Run commands in install.sh

@frne
frne / repository.xml
Last active January 2, 2016 14:09
Some symfony tricks
<?xml version="1.0" ?>
<!-- configuring object repositories as services -->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="entity.repository.facebook_identity"
class="Doctrine\ORM\EntityRepository"
factory-service="doctrine.orm.entity_manager"
@frne
frne / test.php
Last active December 31, 2015 17:49
<?php
interface fooplan
{
function getReverseName();
}
class foo implements fooplan
{
private $name;
@frne
frne / build.xml
Last active December 11, 2015 05:48
Make your PHP Build Workflow Env-Independent
<?xml version="1.0" encoding="UTF-8"?>
<project name="build" default="phpunit">
<target name="phpunit" depends="composer-install">
<exec executable="vendor/bin/phpunit" failonerror="true">
<!-- include group unit -->
<arg line="--group unit"/>
<!-- arg for test directory -->
<arg value="./"/>
</exec>