View format-number.js
function number_format(n) {
n += '';
x = n.split('.');
y = x[0];
z = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(y)) {
y = y.replace(rgx, '$1' + ',' + '$2');
}
return y + z;
View jQuery.mintip.js
/*jslint vars: true, unparam: true, browser: true, white: true */
/*global jQuery */
(function ($) {
"use strict";
var onEnter, onLeave, startTimer, stopTimer, remove, getPos;
var defaults = {
delay: 500,
content: null,
allowHTML: false // XXX: rename
};
View jquery.copylink.js
View sticky-on-scroll.css
#wrapper { position: relative; }
/* Aside in non-scroll mode */
aside {
float: left; /* Keeps the aside to the left and on top */
margin-top: 5px;
padding: 15px 0 15px 8px;
width: 267px;
}
View texterize.php
<?php
function texterize($s = '') {
$s = str_replace(' ', '', $s);
$s = str_split($s);
$s = array_unique($s);
natcasesort($s);
return urlencode(implode($s));
}
View Bcrypt.php
<?php
/*
BCRYPT function group
*/
function bcrypt_hash($password, $work_factor = 8) {
if ($work_factor < 4 || $work_factor > 31) $work_factor = 8;
$salt = '$2a$'.str_pad($work_factor, 2, '0', STR_PAD_LEFT).'$'.
substr(
View next-last.sql
-- The comparison "_CURRENT-ID_" is an integer.
--Last Row:
SELECT `field1`
FROM `tablename`
WHERE `id` < '_CURRENT-ID_'
ORDER BY `id` DESC
LIMIT 1
View styleNumber.js
function styleNumber(number, precision) {
if (number.toString().length >= 4) {
var place = 1;
if (precision !== undefined && precision === 1) {
place = 10;
} else if (precision === 2) {
place = 100;
}
number = ((number / 100) / 10) * place;
number = Math.round(number) / place + ' k';
View ref-mask.php
<?php
session_start();
/**
Setp 1. Get the query string variable and set it in a session, then remove it from the URL.
*/
if (isset($_GET['to']) && !isset($_SESSION['to'])) {
$_SESSION['to'] = urldecode($_GET['to']);
header('Location: http://yoursite.com/path/to/ref-mask.php');// Must be THIS script
exit();
View mobileNav.js
/*
mobileNav.js by Matt Jordan.
*/
(function ($) {
$.fn.mobileNav = function (mobileWidth) {
// Create the <select> element
var selectHTML = '<select name="mobileNav" id="mobileNav" style="display:none">',
currentHref = window.location.href,
checkSize = function () {