Skip to content

Instantly share code, notes, and snippets.

View Mottie's full-sized avatar
💭
🥞

Rob Garrison Mottie

💭
🥞
View GitHub Profile
@Mottie
Mottie / jquery.nval.js
Created December 1, 2015 17:21
jQuery nVal()
/* jQuery nVal() - A jQuery plugin that return numeric values from form elements
* this plugin uses jQuery .val() so it only uses the first element in the set of matched elements
* Examples: http://jsfiddle.net/Mottie/p2b89y5h/
<input value="1234.567">
$('input').val() // returns '1234.567' (string)
$('input').nVal() // returns 1234.567 (numeric)
$('input').nVal( 10 ) // returns 1234 (number; parseInt base 10 radix)
@Mottie
Mottie / README.md
Last active August 16, 2017 19:46

Testing Chrome Extension

This code is meant to supplement this Stackoverflow question: http://stackoverflow.com/q/32288996/145346

To use:

  • Download these files into a folder.
  • Open up Chrome extensions: chrome://extensions/
  • Click on the "Developer mode" checkbox at the top
  • Click on "Load unpacked extension..."
@Mottie
Mottie / pygments.css
Created November 8, 2014 17:19
Pygments theme comparison: GitHub vs. GItHub Dark Solarized Theme vs Pygments default
/* GitHub Pygments 11/8/2014 */ /* GitHub-Dark Solarized Dark theme http://git.io/9P8J1A */ /* http://pygments.org/_static/pygments.css */
.syntax pre .hll { background-color: #ffffcc }
.highlight {background:#fff} .highlight, .highlight pre, .highlight table { background-color: #002b36 !important; color: #93a1a1 !important; } .syntax pre { background: #f0f0f0; }
.highlight .c, .highlight .c { color: #586e75 !important; } /* Comment */ .syntax pre .c { color: #60a0b0; font-style: italic } /* Comment */
.highlight .cm, .highlight .cm { color: #586e75 !important; } /*
/* Shuffle
Modified Fisher-Yates shuffle ( original from http://bost.ocks.org/mike/shuffle/ )
to allow not shuffling specifically mapped array elements
Example:
var arry = [ 'aardvark', 'bison', 'cheeta', 'dingo', 'elephant', 'fawn', 'giraffe', 'hippo' ],
// don't shuffle 'bison' or 'elephant'
map = [ '', false, '', '', false ];
shuffle( arry, map ); // ["fawn", "bison", "dingo", "giraffe", "elephant", "hippo", "cheeta", "aardvark"]
@Mottie
Mottie / Change-last-url-value.html
Last active April 3, 2021 12:08
Useful Bookmarklets
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><A HREF="javascript:(function(){%20var%20e,s;%20IB=-1;%20function%20isDigit(c)%20{%20return%20(%220%22%20<=%20c%20&&%20c%20<=%20%229%22)%20}%20L%20=%20location.href;%20LL%20=%20L.length;%20for%20(e=LL-1;%20e>=0;%20--e)%20if%20(isDigit(L.charAt(e)))%20{%20for(s=e-1;%20s>=0;%20--s)%20if%20(!isDigit(L.charAt(s)))%20break;%20break;%20}%20++s;%20if%20(e<0)%20return;%20oldNum%20=%20L.substring(s,e+1);%20newNum%20=%20%22%22%20+%20(parseInt(oldNum,10)%20+%20IB);%20while%20(newNum.length%20<%20oldNum.length)%20newNum%20=%20%220%22%20+%20newNum;%20location.href%20=%20L.substring(0,s)%20+%20newNum%20+%20L.slice(e+1);%20})();" ADD_DATE="1257995008" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAWklEQVQ4jWNkYGBgiJ8i8J+BDLAw5wMjI7maYYCJEs2D3IAF2e8ZFmS/J88AYjTCAEYsENKcMFWQsAtIAVjTAbIr0G1EB1hdQEgTQReQAgZxQiIWMDIwUJadASvGHReRAe+EAAAAAElFT
@Mottie
Mottie / jquery.tablesorter.pager.js
Created April 16, 2014 23:34
Tablesorter pager v2.15.14 modified to use deferred objects
/*!
* tablesorter pager plugin
* updated 4/16/2014 (v2.15.14-mod); requires jQuery 1.5+
*/
/*jshint browser:true, jquery:true, unused:false */
;(function ($) {
"use strict";
/*jshint supernew:true */
var ts = $.tablesorter;
@Mottie
Mottie / jellybeans.py
Last active August 29, 2015 13:56
Jellybeans Syntax Highlighting Theme
# -*- coding: utf-8 -*-
"""
Jellybeans Colorscheme
~~~~~~~~~~~~~~~~~~~~~~
Converted by Vim Colorscheme Converter
"""
from pygments.style import Style
from pygments.token import Token, Keyword, Number, Comment, Name, Operator, String, Generic
@Mottie
Mottie / gist:8078281
Last active January 1, 2016 02:19
jQuery Quicksearch plugin mod to include childrows for tablesorter
/* jQuery Quicksearch plugin
by riklomas https://github.com/riklomas/quicksearch
Modified to include childRows (for tablesorter)
See http://stackoverflow.com/q/20342203/145346 for
more details
*/
(function($, window, document, undefined) {
$.fn.quicksearch = function (target, opt) {
@Mottie
Mottie / ipv6.js
Last active July 29, 2021 00:58
[JS] Expand Abbreviated IPv6 Addresses (with support for embedded IPv4 Address)
// [JS] Expand Abbreviated IPv6 Addresses
// by Christopher Miller
// http://forrst.com/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR
// Modified to work with embedded IPv4 addresses
function expandIPv6Address(address)
{
var fullAddress = "";
var expandedAddress = "";
var validGroupCount = 8;
var validGroupSize = 4;
@Mottie
Mottie / dabblet.css
Created August 8, 2012 00:26 — forked from LeaVerou/dabblet.css
3D cube
/**
* 3D cube
*/
body {
perspective: 99999px;
}
body > section {
display: inline-block;