Skip to content

Instantly share code, notes, and snippets.

@bubach
bubach / bundlelessApplication.m
Created February 11, 2021 08:18 — forked from karstenBriksoft/bundlelessApplication.m
NSApplication without Bundle
// compile using: clang -fobjc-arc -framework AppKit bundlelessApplication.m -o bundleLess
//
// opens a NSApplication with dock icon and menu bar. NSRunningApplication will return no bundleURL for it
//
// via http://stackoverflow.com/questions/8137538/cocoa-applications-from-the-command-line
// and http://casperbhansen.wordpress.com/2010/08/15/dev-tip-nibless-development/
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
@bubach
bubach / bnf-story-parser-fixed.php
Created November 16, 2019 12:00 — forked from ShayCichocki/bnf-story-parser-fixed.php
BNF form parser, exampled with story generating bnf
<?php
class BNFParserGenerator {
private $defs = [];
/**
* This converts the BNF string into a set of generator definitions
* that we can use later
* @param string $string
@bubach
bubach / tokenizer-iterator.php
Created October 2, 2018 22:26 — forked from mmstick/tokenizer-iterator.php
PHP String Tokenizer: Practicing with PHP
#!/bin/php
<?php
/// TODO:
/// - Implement Backslash escapes
// An ADT-like type that can either be a normal value or a variable.
class Token {
// 0 = Normal; 1 = Variable; 2 = Error; 3 = None
public $kind = 0;
// Contains the string for the associated type.
@bubach
bubach / HTMLElement.js
Created September 2, 2018 02:04 — forked from jonathantneal/HTMLElement.js
HTMLElement polyfill for IE6-7
if (!window.Element) {
(function (prototype) {
function Element() {}
prototype.runtimeStyle.cssText = 'clip:rect(0 0 0 0);height:0;position:absolute;width:0';
document.getElementsByTagName('head')[0].appendChild((window.Element = Element).prototype = prototype).attachEvent('onpropertychange', function (event) {
for (var name = event.propertyName, index = 0, element; element = document.all[index]; ++index) {
if (element !== prototype) {
element[name] = prototype[name];
@bubach
bubach / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console