Skip to content

Instantly share code, notes, and snippets.

View Zegnat's full-sized avatar

Martijn van der Ven Zegnat

View GitHub Profile
@Zegnat
Zegnat / NIM.cpp
Created December 1, 2010 10:54
Pearls before Swine. For school, I am not a C++ developer and never will be.
#include <iostream>
#include <conio+.h>
#include <cmath>
#include <time.h>
using namespace std;
// SETTINGS
#define MIN_LINES 2
#define MAX_LINES 8
@Zegnat
Zegnat / gist:811387
Created February 4, 2011 17:11
CASSIS: Scooping
// Javascript needs you to declare variables inside functions or they will be created in the global scoop.
$var1 = 'global';
function change() {
if (js()) eval('var $var1;');
$var1 = 'scooped';
}
change();
// PHP needs you to declare variables inside functions if you want them to be in the gobal scoop.
$var2 = 'global';
@Zegnat
Zegnat / lol.class.php
Created February 23, 2011 08:56
The lol class will let you code your applications with the word lol only! (Or any other word.)
<?php
class lol {
private $functions;
function __construct() {
$functions = get_defined_functions();
$this->functions = $functions['internal'];
}
public function __call($name, $arguments) {
$l = $i = strlen($name);
$repeater = '';
@Zegnat
Zegnat / builder.php
Created April 18, 2011 10:06
Form builder
<?php
# ### ### ### ### ### ### ### ### ### ###
# HEAD
header('Content-Type: text/html; charset=utf-8');
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('memory_limit', '12M');
function pre_var_dump() {
@Zegnat
Zegnat / README.md
Created July 1, 2011 09:01
Comic Sans Button!

Comic Sans Button!

De Coen & Sandershow heeft een Comic Sans dag ter leven geroepen en Tim heeft er een handige bookmarklet (Wikipedia legt uit) voor gemaakt om het te promoten. Deze is te vinden als de Comic Sans Button!

Een probleem met de originele button.

De originele knop veranderd niet alleen het lettertype van de pagina maar laat ook sporen achter. Normaal maakt dit niks uit maar in theorie kan het een website in de war brengen. Deze nieuwe bookmarklet lost dat probleem op!

@Zegnat
Zegnat / README.md
Created July 4, 2011 10:08
The future of HTML, marking up myself.

How to mark-up yourself.

Currently employing:

  • µF: hCard
    1. fn
    2. n
      1. given-name
      2. family-name
  1. honorific-prefix
@Zegnat
Zegnat / README.mdown
Created September 25, 2011 10:46
A plugin for Jekyll 0.11.0 to allow different types of datestamps for blog posts.

ISO 8601 datestamp support for Jekyll

About

Jekyll is a static site generator with blogging capabilities. For blogging it looks for files starting with a datestamp. In its original form, Jekyll only supports hyphen separated calendar dates (YEAR-MONTH-DAY).

This plugin file tries to implement ISO 8601 datestamps and give you a little more freedom when stamping your posts and building your permalinks with dates.

Installation

@Zegnat
Zegnat / Original.txt
Created September 25, 2011 13:31
Regular expression for ISO 8601 datestamps
^
(\+|-)? # Extended year?
(\d{4,}) # Year
(
(
-? # Optional separator
(0[1-9]|1[012]) # Month, 01 to 12
(?(?<=-\d\d)-) # Require another separator if we used one before
(0[1-9]|[12][0-9]|3[01]) # Day, 01 to 31
)|(
var tld = window.location.hostname.split('.').pop(),
tldExtend = {uk:'GB',za:'ZA',ie:'IE',au:'AU'};
while (treeWalker.nextNode()) {
cN = treeWalker.currentNode;
cNlang =
cN.getAttribute('lang')||cN.getAttribute('xml:lang')||
(('getAttribute' in cN.parentNode&&(l=cN.parentNode.getAttribute('lang')||cN.parentNode.getAttribute('xml:lang'))&&!cN.setAttribute('lang',l))?l:null)||
window.navigator.language;
if (cNlang=='en'&&tld in tldExtend) cNlang+='-'+tldExtend[tld];
@Zegnat
Zegnat / README.md
Created February 24, 2012 12:03
Fixing your skip links. [JS]

Fixing your skip links.

Read Damon Muma on this. He proposes the following jQuery solution (inspired by Thompson, fixed by me):

// Apply focus properly when accessing internal links with keyboard in WebKit browsers.
$("a[href^='#']").not("a[href='#']").click(function() {
   $("#"+$(this).attr("href").slice(1)+"").focus();
});