Skip to content

Instantly share code, notes, and snippets.

View alkemann's full-sized avatar

Alexander Morland alkemann

View GitHub Profile
[color]
ui = auto
diff = always
status = always
branch = always
interactive = always
[color "branch"]
current = 220
local = 222
remote = 106

Keybase proof

I hereby claim:

  • I am alkemann on github.
  • I am lake (https://keybase.io/lake) on keybase.
  • I have a public key whose fingerprint is 4B50 4829 9001 5CA2 78D7 1B1F C21D FEFB 21E2 5F15

To claim this, I am signing this object:

[color]
ui = auto
diff = auto
status = always
branch = always
interactive = always
[color "branch"]
current = 220
local = 222
remote = 106
@alkemann
alkemann / tests.php
Created October 4, 2011 14:04
Run PHPUnit tests in browser for ease of reading, running subsets or debuggin.
<?php
/**
* Place this file in the webroot of your project,
* access it through http://project.dev/tests.php or http://localhost/project/webroot/tests.php
*
* Assuming you have defined a BASEPATH to the root of your project and
*/
define('BASEPATH', __DIR__.'/..'); // root of project, this one assumes /project/webroot/tests.php
define('LOCATION', BASEPATH .'/app'); // in a SF2 project, this is where the phpunit.xml file is
@alkemann
alkemann / phone valid
Created October 31, 2011 21:21
get valid phone numbers
function _oneValidPhoneNumber($in) {
$stripped = preg_replace("/^[^0-9+]*[+]*46/", "+46", $in);
$stripped = preg_replace("/^[^0-9+]*[+]*47/", "+47", $in);
$stripped = preg_replace("/[^0-9+]/", "", $stripped);
$stripped = preg_replace("/^0046/", "+46", $stripped);
$stripped = preg_replace("/^0047/", "+47", $stripped);
if (!$stripped) return false;
if ($stripped[0] == '0') {
$stripped = substr($stripped, 1);
@alkemann
alkemann / Job.cs
Last active February 14, 2016 15:01
Worker AI picking jobs and moving to them using Coroutines without any Frame Update calls
using UnityEngine;
public class Job {
public GameObject site;
public float workload = 3f;
public Job (GameObject site, float workload) {
this.site = site;
this.workload = workload;
}
}
@alkemann
alkemann / FallingBodies.js
Last active March 5, 2017 00:32
P5.js with Matter.js .. click and hold to drop balls of various sizes
const engine = Matter.Engine.create(),
ground = new Ground(x = 200, y = 360, w = 600, h = 50, a = 0.2),
shelf = new Ground(x = 250, y = 150, w = 200, h = 30, a = -0.2);
var bodies = [], lastFrame, rad = 2;
function setup() {
createCanvas(400, 400);
frameRate(60);
stroke(200);
fill(150);
@alkemann
alkemann / unlocked.sh
Last active March 14, 2017 10:50
Punish people for unlocked laptops
echo '*/15 * * * * say `curl -s http://catfacts-api.appspot.com/api/facts |python -mjson.tool|grep facts -a1|tail -n1`' | crontab -
swagger: "2.0"
info:
version: "1.0.0"
title: "Swagger Petstore"
basePath: "/v2"
schemes:
- "http"
paths:
/pet:
post:
@alkemann
alkemann / markdown.syntax.highlighter.patch
Created September 4, 2017 13:40
A Patch trying to fix markdown code blocks
Index: src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java (date 1499692487000)
+++ src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java (revision )
@@ -227,6 +227,20 @@
return listingBlock(replaceNewLines(text), null);
}