This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The comparison "_CURRENT-ID_" is an integer. | |
--Last Row: | |
SELECT `field1` | |
FROM `tablename` | |
WHERE `id` < '_CURRENT-ID_' | |
ORDER BY `id` DESC | |
LIMIT 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function texterize($s = '') { | |
$s = str_replace(' ', '', $s); | |
$s = str_split($s); | |
$s = array_unique($s); | |
natcasesort($s); | |
return urlencode(implode($s)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// USE: <a href="http://yoursite.com/" rel="copylink">yoursite.com</a> | |
$(document).ready(function () { | |
$(window).on("click", "a[rel=copylink]", function (e) { | |
e.preventDefault(); | |
var href = $(this).prop("href"), | |
txt = $(this).text(); | |
$(this).hide().parent().html('<input type="text" value="' + href + '" data-href="' + href + '" data-txt="' + txt + '" width="20" class="copyinput">'); | |
$(".copyinput").focus().select() | |
}).on("blur", ".copyinput", function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder