Skip to content

Instantly share code, notes, and snippets.

View dennisvennink's full-sized avatar

Dennis Vennink dennisvennink

  • Rotterdam, The Netherlands
View GitHub Profile
@dennisvennink
dennisvennink / statusBarHidden.md
Created May 2, 2016 05:09
iOS 9 statusBarHidden Replacement

Since iOS 9 UIApplication.sharedApplication().statusBarHidden is deprecated. Use UIApplication.sharedApplication().statusBarFrame.size == CGSizeZero instead.

@dennisvennink
dennisvennink / gist:1f0bcfbd3da55fcd7ec4
Created March 23, 2015 19:26
Object.prototype.extend
Object.prototype.extend = function (object) {
var Constructor = object.initialize;
Constructor.prototype = Object.create(this.prototype);
Object.keys(object).forEach(function (key) {
if (key !== "initialize") {
Constructor.prototype[key] = object[key];
}
});
module Main where
import Prelude hiding (until)
-- import System.CPUTime
-- 2.1 Semantic Domains
type Time = Double
type Behavior a = Time -> a
type Event a = (Time, a)
-- type Events a = [Event a]
#!/usr/bin/env runhaskell
import Data.Either (either)
import Network.HTTP (simpleHTTP, getRequest, rspBody)
main :: IO ()
main = simpleHTTP (getRequest "http://www.wikipedia.org/") >>= print . either show rspBody
@dennisvennink
dennisvennink / endian.h
Created April 23, 2013 22:00
Retrieves the host's byte order. Requires C99.
#ifndef ENDIAN_H
#define ENDIAN_H
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 0
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 1
#endif
@dennisvennink
dennisvennink / gist:1359808
Created November 12, 2011 00:46
Better JavaScript code folding in TextMate.

For some strange reason, JavaScript code folding in TextMate is limited to functions; leaving out JSON, simple statements delimited by brackets, and arrays.

In order to change this behaviour, open up the Bundle Editor (Bundles → Bundle Editor → Show Bundle Editor). From the dropdown menu in the top left corner select 'Languages', expand 'JavaScript' (click the triangle) and choose the JavaScript Language Grammar (the item with the L next to it). Find 'foldingStartMarker' and 'foldingStopMarker' in the list on the right and replace their values with:

foldingStartMarker = '\{\s*$|\[\s*$|\(\s*$';

foldingStopMarker = '^\s*}|^\s*]|^\s*)';