Skip to content

Instantly share code, notes, and snippets.

Hay Kranen hay

Block or report user

Report or block hay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ex1.js
(function() {
var Module = {
create : function() {
return Object.create(this);
}
};
window.Stapes = {
create : function() {
return Object.create(Module);
@hay
hay / has-overflow-scrolling.js
Created Nov 7, 2012
Check if a browser supports the overflow-scrolling CSS property, optionally with a prefix
View has-overflow-scrolling.js
function hasOverflowScrolling() {
var prefixes = ['webkit', 'moz', 'o', 'ms'];
var div = document.createElement('div');
var body = document.getElementsByTagName('body')[0];
var hasIt = false;
body.appendChild(div);
for (var i = 0; i < prefixes.length; i++) {
var prefix = prefixes[i];
@hay
hay / google-plus-clean-gui.user.js
Created Sep 16, 2012
Google Plus Clean GUI user script for non-logged in users
View google-plus-clean-gui.user.js
// ==UserScript==
// @match *://plus.google.com/*
// ==/UserScript==
[
'#gb',
'#contentPane > div:first-child',
'.l-Ps.Vka',
'.mp.pu',
'.wl.cVa',
'.Uda.NTa.Uua',
View ex10.js
{
"70c427d6-3cf1-4a67-b5c7-24b7c8c5ee94" : {
"text" : "spam"
},
"97f6a71d-9696-4977-a0b9-87f3be747a3e" : {
"text" : "eggs"
}
};
@hay
hay / ex1.html
Last active Oct 7, 2015
Learn Javascript MVC: create a todo list using Stapes.js in less than 100 lines code (part 2)
View ex1.html
<script type="text/html" id="template">
<ul>
{{#todos}}
<li data-id="{{id}}">
<input type="checkbox" class="remove" />
{{text}}
</li>
{{/todos}}
</ul>
@hay
hay / app.js
Last active Dec 16, 2016
Learn Javascript MVC: create a todo list using Stapes.js in less than 100 lines code (part 1) examples
View app.js
var TodosModel = Stapes.subclass();
var TodosView = Stapes.subclass({
constructor : function(model) {
var self = this;
this.$el = $("#inputform");
this.model = model
var $input = this.$el.find("input");
@hay
hay / gist:1351230
Created Nov 9, 2011
Enterprisify your Java Class Names!
View gist:1351230
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@hay
hay / jquery.detailsshim.js
Created Dec 20, 2010
A jQuery plugin that enables the behaviour of the HTML5 <details> and <summary> elements.
View jquery.detailsshim.js
(function($) {
$.detailsShim = function() {
$("details").each(function() {
// Initial state of all elements in <section>
var initOpen = ($(this).attr('open') === "true") ? true : false;
$(this).children(":not(summary)").each(function() {
$(this).toggle(initOpen);
});
// Click event on <summary> toggles all elements
@hay
hay / dlcat.py
Created Nov 6, 2010
Download all images in a category on Wikimedia Commons. Requires pywikipedia
View dlcat.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -cat:Images_from_Wiki_Loves_Monuments
import sys, os
# Set your path to pywikipedia here
sys.path.append("/Users/hay/htdocs/checkouts/pywikipedia/")
import wikipedia, config, pagegenerators
import urllib2, codecs
@hay
hay / whoisnl
Created Sep 27, 2010
Script to do a WHOIS for Dutch .nl domains from the terminal
View whoisnl
#!/usr/bin/php
<?php
$domain = $argv[1];
if (!$domain) die("No domain given \n");
$domain = trim($domain);
$domain = str_replace(".nl", "", $domain);
$data = file_get_contents("https://www.sidn.nl/index.php?eID=tx_sidnwhois_pi1&domain=$domain&reg=44&det=0&lang=nl&check=true&adv=1&regmode=0");
You can’t perform that action at this time.