Skip to content

Instantly share code, notes, and snippets.

View yckart's full-sized avatar

Yannick Albert yckart

View GitHub Profile
@yckart
yckart / LICENSE.txt
Last active December 21, 2015 23:39 — forked from 140bytes/LICENSE.txt
Namespacer
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yckart
yckart / LICENSE.txt
Last active December 21, 2015 23:39 — forked from 140bytes/LICENSE.txt
formatNumber
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yckart
yckart / LICENSE.txt
Last active December 21, 2015 23:39 — forked from 140bytes/LICENSE.txt
readingTime
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yckart
yckart / LICENSE.txt
Last active December 27, 2023 15:40 — forked from 140bytes/LICENSE.txt
getElementByXPath | Get DOM-Nodes by its XPath.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
var DOMReady = function r(fn) {
if (document.readyState === 'complete') return fn();
setTimeout(function () {
r(fn);
});
};
@yckart
yckart / debounce.js
Last active January 13, 2016 19:22
throttle/debounce javascript
// call after last delay
function debounce(callback, delay) {
var timeout;
return function () {
var self = this, args = arguments;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(function () {
callback.apply(self, args);
}, delay || 100);
};

#ECMAScript 1

In the beginning, there was ECMAScript 1. It listed the following reserved words:

do
if
in
for
new
// Set the graphics attributes specified by the properties of the object o.
// Or, if no argument is passed, return the current attributes as an object.
// Note that this does not handle the transformation or clipping region.
CanvasRenderingContext2D.prototype.attr = function (key, val) {
var keyString = typeof key === 'string';
var valUndefined = typeof val === 'undefined';
var styles = {
fillStyle: this.fillStyle,
font: this.font,
// jonathantneal's polyfill for matchesSelector
if (this.Element) function(ElementPrototype) {
ElementPrototype.matches = ElementPrototype.matchesSelector =
ElementPrototype.matchesSelector ||
ElementPrototype.webkitMatchesSelector ||
ElementPrototype.mozMatchesSelector ||
ElementPrototype.msMatchesSelector ||
ElementPrototype.oMatchesSelector ||
function (selector) {
var nodes = (this.parentNode || this.document).querySelectorAll(selector), i = -1;
@yckart
yckart / _readme.md
Last active December 19, 2015 07:18
Adding Multiple Web Environments to Anchor CMS - http://abandon.ie/notebook/adding-multiple-web-environments-to-anchor-cms

Step 1. Install Anchor as normal.

Step 2. Create the environments file.

Create a new php file called environments.php save it into the anchor folder and add this content:

<?php
 
// Define Environments - may be a string or array of options for an environment