Skip to content

Instantly share code, notes, and snippets.

@hagenburger
hagenburger / javascript_loader.js
Created July 30, 2010 15:28
Dynamically load JavaScript files with callback when finished
// Example:
JavaScript.load("/javascripts/something.js");
// With callback (that’s the good thing):
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@tbrianjones
tbrianjones / free_email_provider_domains.txt
Last active April 24, 2024 10:24
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com
@xeoncross
xeoncross / domdocument_encoding.php
Last active July 8, 2023 14:46
Fix HTML encoding errors with PHP DOMDocument
<?php
// Ignore errors
libxml_use_internal_errors(true) AND libxml_clear_errors();
// http://stackoverflow.com/q/10237238/99923
// http://stackoverflow.com/q/12034235/99923
// http://stackoverflow.com/q/8218230/99923
// original input (unknown encoding)
@Kudratullah
Kudratullah / unicode2html.php
Last active February 22, 2017 20:16
Convert UniCode Escape Character to UTF-8
<?php
// Works Perfict
function uni2html($string){
//preg_replace(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1.
//so can't use $string = preg_replace('/\\u([0-9A-Za-z]+)/', '&#x$1;', $string); directly.
$string = explode('\\', $string);
$string = implode('%', $string);
$string = preg_replace('/%u([0-9A-Za-z]+)/', '&#x$1;', $string);
return html_entity_decode($string, ENT_COMPAT, 'UTF-8');