Skip to content

Instantly share code, notes, and snippets.

View git-commit's full-sized avatar

Maximilian Berger git-commit

View GitHub Profile
@git-commit
git-commit / .block
Created May 27, 2019 15:32 — forked from alandunning/.block
Radar Chart D3 V4
height: 650
1
15
...............
...............
...............
...............
...............
...............
...............
...............
//: Playground - noun: a place where people can play
import UIKit
import GameplayKit
extension Collection {
/// Returns the element at the specified index iff it is within bounds, otherwise nil.
subscript (safe index: Index) -> Element? {
return indices.contains(index) ? self[index] : nil
/**
* Generate a unique name such as sim_batch042
* @param proposedName starting name
* @param nameExists predicate that should return true if the name already exists
* @return unique filename
*/
public static String generateUniqueName(String proposedName, String appendStringBeforeNumbers, Predicate<String> nameExists)
{
if (!nameExists.test(proposedName))
{
// MARK: UIViewControllerAnimatedTransitioning protocol methods
extension DetailTransitionManager: UIViewControllerAnimatedTransitioning {
// animate a change from one viewcontroller to another
func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
// get reference to our fromView, toView and the container view that we should perform the transition in
let container = transitionContext.containerView()
// create a tuple of our screens
let screens: (from: UIViewController, to: UIViewController) = (transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!, transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!)
// MARK: Setting the initial conditions for the transition animations
container!.addSubview(screens.to.view)
@git-commit
git-commit / RegexTest.java
Last active April 30, 2016 23:09
Testing regex performance for matching 5 or more "tokens" and comparing it with substring and indexOf
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexTest {
static Matcher m = Pattern.compile("(biba.*){5,}").matcher("");
public static void main(String[] args) {
from __future__ import division
uo_dict = {"0,0": 1}
def unordered_partition(n, k):
if n < k:
return 0
if k == 0:
return 0
if n == k:
@git-commit
git-commit / twitch.py
Created April 18, 2016 16:24
Flask example with twitch oauth
from flask import Flask
from flask_oauthlib.client import OAuth
from flask import session, redirect, request, url_for, jsonify
import requests
import json
import config
app = Flask(__name__)
app.secret_key = "development"
@git-commit
git-commit / twitch.py
Created April 18, 2016 16:24
Flask example with twitch oauth
from flask import Flask
from flask_oauthlib.client import OAuth
from flask import session, redirect, request, url_for, jsonify
import requests
import json
import config
app = Flask(__name__)
app.secret_key = "development"
// autoexec.cfg for Counter-Strike: Global Offensive
// Place in <steamfolder>\steamapps\common\Counter-Strike Global Offensive\csgo\cfg
// Launch options: -novid -high -nojoy -threads 4 -tickrate 128
// performance
sv_forcepreload 1
cl_forcepreload 1
fps_max 484