Skip to content

Instantly share code, notes, and snippets.

View yckart's full-sized avatar

Yannick Albert yckart

View GitHub Profile
@yckart
yckart / jquery.geolocation.js
Last active October 10, 2015 16:37
Geolocation fallback using jQuery.ajax
/*!
* Geolocation HTML5 API Polyfill/Shim
*
* This polyfill fixes geolocation for miscellaneous web browsers.
* It is tested and supports IE 7+, Chrome 11+ and Firefox 3.6+
*
* @Deps: http://geoplugin.net/json.gp
*
* @author: Yannick Albert
* @url: http://www.yckart.com/
@yckart
yckart / LICENSE.txt
Last active October 10, 2015 17:57 — forked from 140bytes/LICENSE.txt
countdownR: Counts an array or given number down
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 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 October 10, 2015 17:58 — forked from 140bytes/LICENSE.txt
previewR: Shows what you type in an input-field or in a textarea.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 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 October 10, 2015 18:07 — forked from 140bytes/LICENSE.txt
throttle: Delays a function to a specified number of milliseconds.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 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
Created September 22, 2012 19:49 — forked from 140bytes/LICENSE.txt
keyeventR: A tweety keyevent-handler
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 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 / index.html
Created November 10, 2012 14:36
Get the biggest/heighest element
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<style>
ul {
float:left;
margin: 5px 0 0 5px;
@yckart
yckart / jquery.konami.js
Created November 30, 2012 15:44
Letter konami-code [jQuery Plugin]
jQuery.konami = function(fn, code) {
// ↑ ↑ ↓ ↓ ← → ← → B A
code = code || [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
var i = 0;
$(document).keydown(function(e) {
var char = typeof code === 'string' ? String.fromCharCode(e.which).toLowerCase() : e.which;
i = char === code[i] ? i + 1 : 0;
if (i === code.length) {
fn();
@yckart
yckart / jquery.act.js
Created December 2, 2012 23:58
jQuery function to allow multiple events via `on`-event on one element with different functions and target selectors
;(function($) {
$.fn.act = function() {
var args = arguments;
return this.each(function() {
for (var i = args.length; i--;) {
$(this).on(args[i][0], args[i][1], args[i][2]);
}
});
};
})(jQuery);
var getPrefix = (function(browser) { // Closure for putting result in cache
var prefixes = {firefox:'moz', applewebkit:'webkit', webkit:'webkit', opera:'o', msie:'ms'};
for (var p in prefixes)
if (browser.indexOf(p) !== -1) return prefixes[p];
return false;
})(navigator.userAgent.toLowerCase());
// console.log(getPrefix);
@yckart
yckart / URIcomponent.js
Last active December 28, 2022 23:56
Encode/Decode UTF8 with javascript. more at: https://gist.github.com/avenauche/4585741
// http://kenany.me/blog/base64-js/
var utf8 = {
encode: function(str) { return unescape( encodeURIComponent(str) ); },
decode: function(str) { return decodeURIComponent( escape(str) ); }
};