Skip to content

Instantly share code, notes, and snippets.

View mrcljx's full-sized avatar

Marcel Jackwerth mrcljx

View GitHub Profile
class BooleanContainer(Container[_T]):
"""A container that supports boolean operations."""
def __init__(
self,
container: Container[_T] | None = None,
predicate: Callable[[object], _T] | None = None,
) -> None:
if container is not None:
assert predicate is None, "Cannot specify both container and predicate"
@mrcljx
mrcljx / eof_fixer.py
Created October 26, 2023 16:01
EOF Fixer (exactly one newline)
#!/usr/bin/env python3
"""
Check if files end with a single newline.
"""
import argparse
import io
import logging
import pathlib
import sys
from collections.abc import Iterator
@mrcljx
mrcljx / keybase.md
Created February 19, 2019 17:10
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

class Card {}
class Customer {
var optionalCard: Card?
var card: Card
init() {
self.card = Card() // required to avoid compiler error (card2 would be nil)
}
}
let john : Customer? = Customer()
module ResourcesController
extend ActiveSupport::Concern
def index
render json: resources
end
def show
render json: resource
@mrcljx
mrcljx / build.gradle
Created February 5, 2014 10:50
Simple Gradle Buildfile for PebbleKit 2.0
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8+'
}
}
@mrcljx
mrcljx / mono.rb
Last active December 21, 2015 14:09 — forked from shtirlic/mono.rb
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.2.1.tar.bz2'
sha1 '7f4f31e03903719e370e7ee94ded376b96bdf6d9'
homepage 'http://www.mono-project.com/'
@mrcljx
mrcljx / root.gitignore
Created July 24, 2013 10:47
Gitignores for IDEA based on http://devnet.jetbrains.com/docs/DOC-1186. Either use `root.gitignore` (if you have git version 1.8.2) or use `subfolder.gitignore` and place it in your .idea folder.
.idea/**/*.iws
.idea/workspace.xml
.idea/tasks.xml
@mrcljx
mrcljx / example.coffee
Last active December 19, 2015 07:29
Simple KO support library
class SampleViewModel extends ko.ViewModel
@property "firstName"
@property "lastName"
@accessor "fullName",
read: ->
@firstName() + " " + @lastName()
write: (v) ->
[first, last] = v.split(" ")
@firstName first
@mrcljx
mrcljx / n2dissite.sh
Created May 21, 2012 19:17 — forked from hlfbt/n2dissite.sh
Nginx-to-ensite and Nginx-to-dissite - Two simple scripts that enable and disable Nginxs virtualhost VHOST. Adapt VHOSTEN and VHOSTAV accordingly, place in /usr/sbin and enjoy.
#!/bin/bash
# Author: Alexander Schulz
VHOSTEN="/etc/nginx/sites-enabled/"
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]
then
echo 'Usage: n2dissite VHOST'
echo 'Disables Nginxs virtualhost VHOST.'