Skip to content

Instantly share code, notes, and snippets.

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
//
// the regular expression composed & commented
// could be easily tweaked for RFC compliance,
// it was expressly modified to fit & satisfy
// these test for an URL shortener:
@dinh
dinh / u.user.js
Created July 27, 2016 11:38 — forked from jr-codes/u.user.js
u.js userscript
// ==UserScript==
// @name u.js
// @namespace http://zarjay.net/
// @description Utility functions for browser console ninjas
// @include *
// @version 0.28
// ==/UserScript==
exec(function() {
// Current version of u.js
@dinh
dinh / bookmarklet.js
Created July 30, 2016 12:10 — forked from kn0ll/bookmarklet.js
advanced bookmarklet template
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
@dinh
dinh / addstyle.user-tpl.js
Created August 9, 2016 05:42
addStyle function for userscripts
function myAddStyler (cssArray) {
/*
myAddStyler([
"element { rule : 1 }",
"element { rule : 2 }"
]);
*/
if ( !cssArray || !cssArray.length ) return;
var css = cssArray.join("\n"),
heads,
@dinh
dinh / escapeAll.js
Created August 9, 2016 05:47
escapeAll.js
// https://arkofmind.wordpress.com/2011/04/27/escape-all-characters-in-javascript/
// extended from: http://sharkysoft.com/tutorials/jsa/content/018.html
/* global unescape */
(function () {
"use strict";
function escapeAll (str) {
var hexString = "";
for (var c in str) {
@dinh
dinh / index.html
Last active May 14, 2017 17:16 — forked from anonymous/index.html
Tabbed Widget// source https://jsbin.com/vimikot
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Tabbed Widget<style id="jsbin-css">
body {
background: #eee
}
.widget {
@dinh
dinh / dom-helper.js
Created October 26, 2017 20:15 — forked from SitePointEditors/dom-helper.js
Mini jQuery, sort of.
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
@dinh
dinh / udo-inspector-bookmarklet.js
Created October 30, 2017 09:00 — forked from fiann/udo-inspector-bookmarklet.js
Tealium UDO Inspector bookmarklet
javascript:(function(){window.open("","UDO Inspector","width=600,height=514,scrollbars=1"/*,resizable=1"*/).document.write('<script language="JavaScript" id="udoaudit" src="//tags.tiqcdn.com/utag/adrian-test/tools/dev/utag.4.js?'+Math.random()+'"><\/script>');}());
@dinh
dinh / the-one-bookmarklet.js
Created October 30, 2017 09:44 — forked from juliandescottes/the-one-bookmarklet.js
Spawn a tiny UI to create a bookmarklet. (see comment for the bookmark-ready javascript code)
(function () {
/**
* Adapted from http://ted.mielczarek.org/code/mozilla/bookmarklet.html
*/
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
@dinh
dinh / jquery-turbolinks-compatibility.js
Created March 25, 2018 22:29 — forked from AndrewSouthpaw/jquery-turbolinks-compatibility.js
jQuery Turbolinks compatibility file in JS