Skip to content

Instantly share code, notes, and snippets.

View tcarlsen's full-sized avatar

Thomas Carlsen tcarlsen

  • Ekstra Bladet
  • Copenhagen, Denmark
View GitHub Profile
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@tcarlsen
tcarlsen / jQuery.beforeafter.js
Created May 17, 2011 10:30
modified by TCarlsen to work whit jQuery UI Touch Punch
/*
* jQuery beforeafter plugin
* @author [email protected] - http://www.catchmyfame.com
* @version 1.2
* @date October 18, 2010
* @category jQuery plugin
* @copyright (c) 2009 [email protected] (www.catchmyfame.com)
* @license CC Attribution-NoDerivs 3.0 Unported - http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
// before image : $('div:eq(2)', obj)
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
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
@MrOrz
MrOrz / xdomainrequest.js.coffee
Created September 1, 2013 16:07
Patching `XMLHttpRequest` for AngularJS and Internet Explorer < 10. It replaces the original `window.XMLHttpRequest` with a thin interface that only implements the parts AngularJS core uses. Missing methods of `XDomainRequest` are fed with `angular.noop`.
# A XMLHttpRequest wrapper for IE < 10.
# When it comes to cross domain ajax requests, it uses XDomainRequest instead.
# ** Only supports GET and POST requests! **
# Targeting IE < 10
# https://github.com/amcintyre-cs/strophejs-plugins/commit/b0a6ff2571bb70dd2f6f65c46034f4e47d75d564
return unless window.XDomainRequest and !("withCredentials" in window.XMLHttpRequest)
OriginalXMLHttpRequest = window.XMLHttpRequest
window.location.origin ?= window.location.protocol + '//' + window.location.host
@ardcore
ardcore / atom-events
Last active October 13, 2021 20:35
atom.io events
application:open-your-keymap
application:open-your-stylesheet
autocomplete:attach
autoflow:reflow-paragraph
bookmarks:clear-bookmarks
bookmarks:jump-to-next-bookmark
bookmarks:jump-to-previous-bookmark
bookmarks:toggle-bookmark
bookmarks:view-all
check:correct-misspelling
@tcarlsen
tcarlsen / dynamic-iframe.js
Created July 7, 2014 11:29
Dynamic iFrame height
function updateIframeSize() {
$('iframe.dynamic').height(window.innerHeight - ($('.header').height())).width("100%");
}
updateIframeSize();
@meandmax
meandmax / getcookiebyname.js
Last active October 27, 2020 02:01
get the cookie value by name if a cookie name exists.
/**
* get cookie by name without using a regular expression
*/
var getCookie = function(name) {
var getCookieValues = function(cookie) {
var cookieArray = cookie.split('=');
return cookieArray[1].trim();
};
var getCookieNames = function(cookie) {
@tcarlsen
tcarlsen / Todo.md
Last active August 29, 2015 14:07
My Berlingske ToDo list