Skip to content

Instantly share code, notes, and snippets.

View b00gizm's full-sized avatar
💭
I may be slow to respond.

Pascal Cremer b00gizm

💭
I may be slow to respond.
View GitHub Profile
@font-face {
font-family: "Operator Mono";
font-style: normal;
font-weight: 200;
src: url('data:font/otf;charset-utf-8;base64,T1RUTwAMAIAAAwBAQ0ZGIGmv3kEAABCIAABo00RTSUcAAAABAACFyAAAAAhHUE9TTGZfxAAAeVwAAACwR1NVQjtfIFwAAHoMAAAITk9TLzJYTuWwAAABMAAAAGBjbWFwm+JeqAAACngAAAXuaGVhZAb+gqEAAADMAAAANmhoZWEGLwDqAAABBAAAACRobXR4RvNHRQAAglwAAANqbWF4cAGyUAAAAAEoAAAABm5hbWXbDDN9AAABkAAACOdwb3N0/7AAQQAAEGgAAAAgAAEAAAABAIPnc21TXw889QADA+gAAAAA0r17ywAAAADSvcIb//b+4AJ2BHgAAAADAAIAAAAAAAAAAQAAA8D/EAAAAib/9v+wAnYAAQAAAAAAAAAAAAAAAAAAAAMAAFAAAbIAAAADAiYBRQAFAAQCgwKD/+EAoAKDAoMAPQE7AEABRgAAAgAACQAAAAAAAKAAAP8QAABbAAAAAAAAAABIJkNvAAAAIOENAyD/OADIA8AA8AAAAIsAAAAAAeoCbAAAACAAAwAAAC4CLgABAAAAAAAAADoAAAABAAAAAAABAA0AOgABAAAAAAACAAQARwABAAAAAAADAB8ASwABAAAAAAAEABIAagABAAAAAAAFAA0AfAABAAAAAAAGABEAiQABAAAAAAAHAGAAmgABAAAAAAAIAA0A+gABAAAAAAAJAA0A+gABAAAAAAALABIBBwABAAAAAAAMABIBBwABAAAAAAANAIIBGQABAAAAAAAOACsBmwABAAAAAAAQAA0AOgABAAAAAAARAAQARwABAAAAAAEAABgBxgABAAAAAAEBAAwB3gABAAAAAAECAA0B6gABAAAAAAEDABQB9wABAAAAAAEEAA4CCwABAAAAAAEFAB
@b00gizm
b00gizm / queens.js
Last active August 21, 2017 22:03
The "N-Queen Problem" from The Whispered World
/**
* Helper function: Creates a "range array" from 0 to n-1
*
* @param {number} n Number of elements in range array
* @return {Array} The range array
*/
const range = n => [...Array(n+1).keys()].slice(1);
/**
* Helper function: returns a random number between min and max
@b00gizm
b00gizm / Game.elm
Last active December 30, 2016 14:01
import Html exposing (text)
type alias Energy = Int
type alias Position = { x: Int, y: Int }
type alias GameObject = { pos: Position, kind: Kind }
type Kind = Lifeform Energy | Obstacle
moveTo: GameObject -> Position -> GameObject
moveTo obj newPos =
@b00gizm
b00gizm / update_repo.py
Created November 20, 2016 16:53
Working with Git from iOS (Pythonista + Working Copy)
from collections import OrderedDict
import editor
import re
import sys
from urllib.parse import urlencode, quote
import webbrowser
key = "<YOUR KEY>"
def get_path():
@b00gizm
b00gizm / MobileBlogger.py
Created November 18, 2015 14:34
MobileBlogger.py
# coding: utf-8
import appex
import console
import keychain
import dialogs
import re
from pygithub3 import Github
@b00gizm
b00gizm / baconjs-playground.js
Created June 13, 2014 08:35
Just a very brief introduction to Bacon.js
// Bacon.js playground
// This is how event handling is done in jQuery
$('#btn').on('click', function(evt) {
alert("I was clicked!");
});
// This is how you do it in Bacon.js
var click = $('#btn').asEventStream('click');
click.onValue(function(evt) {
@b00gizm
b00gizm / gist_importer.py
Created October 7, 2013 11:45
Gist importer script for Pythonista (iOS)
import keychain
import requests
import editor
import sys
import re
GITHUB_USER = 'your_github_username'
GITHUB_TOKEN = keychain.get_password('github', GITHUB_USER)
FOLDER_PREFIX = '' # Usage: 'Path/to/folder/'
@b00gizm
b00gizm / LoginOrSignupType.php
Created July 12, 2013 13:21
Adding a validation constraint in Symfony2 based on the existence and value of a form field via Symfony's form events. Good idea (best practice?) or dirty hack..?
<?php
namespace T7\Bundle\OAuthBundle\Form;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\ExecutionContextInterface;
@b00gizm
b00gizm / config.ru
Created September 10, 2012 10:14 — forked from marzocchi/config.ru
Run Symfony2 apps with Rack (rackup! pow!)
# vim:se filetype=ruby
# vim:se foldlevel=3
#
# Hacks and monkeys to run Symfony2 applications as Rack apps using
# the rack-legacy and rack-rewrite gems.
#
# A couple of rack-rewrite rules take care of handing requests to the
# default front controller (app.php) and a subclass of rack-legacy's
# Php fixes PATH_INFO for Symfony routing.
#
@b00gizm
b00gizm / Apache error log
Created September 28, 2011 21:49
Pimple crashes my PHP (no, really.)
[Wed Sep 28 23:44:22 2011] [notice] child pid 42995 exit signal Segmentation fault (11)