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 | |
// Port of http://code.google.com/p/loolu/source/browse/trunk/common/lib/url/hash.py to PHP | |
/** | |
* LooLu is Copyright (c) 2009 Shannon Johnson, http://loo.lu/ | |
*/ | |
class URLHash { | |
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 | |
/** | |
* Truncate text | |
* | |
* @param $text | |
* @param $max | |
* @param $type | |
* @param $suffix | |
*/ |
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 | |
/** | |
* Validate orgnr | |
* Validates an string number according to the brreg spec | |
* https://www.brreg.no/om-oss/oppgavene-vare/alle-registrene-vare/om-enhetsregisteret/organisasjonsnummeret/ | |
* | |
* Test case: https://repl.it/repls/TechnicalForcefulBsddaemon | |
* | |
* @param <string> $value |
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
/** | |
* Numeric.js | |
* | |
* @author Cristobal Dabed | |
* @version 0.1 | |
*/ | |
(function ($) { | |
var re = new RegExp('[A-Za-z\\]\\[!\\"#$%&\'()*+,.\\/:;<=>?@\\^_`{|}~-]'); | |
var re_s = new RegExp("\\D"); |
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
/** | |
* Test for IE | |
* - http://blogs.msdn.com/giorgio/archive/2009/04/14/how-to-detect-ie8-using-javascript-client-side.aspx | |
* - http://blogs.msdn.com/mikeormond/archive/2008/09/25/ie-8-compatibility-meta-tags-http-headers-user-agent-strings-etc-etc.aspx | |
* - http://msdn.microsoft.com/en-gb/library/cc817572.aspx | |
* - http://stackoverflow.com/questions/5825385/javascript-can-i-detect-ie9-if-its-in-ie7-or-ie8-compatibility-mode | |
*/ | |
if(window.ActiveXObject){ | |
var rv = -1; | |
var ua = navigator.userAgent; |
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
--[[ | |
LUA variant of the php unserialize function | |
Port of http://phpjs.org/functions/unserialize | |
]]-- | |
local function unserialize (data) | |
local function utf8Overhead (chr) | |
local code = chr:byte() | |
if (code < 0x0080) then | |
return 0 |
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
--[[ | |
LUA variant of the php serialize function | |
Port of http://phpjs.org/functions/unserialize | |
]]-- | |
function serialize (mixed_value) | |
-- body | |
local val, key, okey, | |
ktype, vals, count, _type; | |
ktype = ''; vals = ''; count = 0; |
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
# 1. Downdload the latest distribution from http://nodejs.org | |
# 2. Extract the nodejs distribution | |
$> tar zxvf node-{version}.tar.gz | |
$> cd node-{version} | |
# 3. Configure and gmake with the location for your distribution i.e. | |
$> ./configure --prefix=$HOME/local | |
$> gmake | |
$> gmake install |
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 date (format, timestamp) | |
-- @credits https://raw.github.com/kvz/phpjs/master/functions/datetime/date.js | |
local c = {} | |
local f = nil | |
local formatPattern = "%a" | |
local pad = function (v, s) | |
v = tostring(v) | |
if string.len(v) < s then |
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 strpos (haystack, needle, offset) | |
local pattern = string.format("(%s)", needle) | |
local i = string.find (haystack, pattern, (offset or 0)) | |
return (i ~= nil and i or false) | |
end |
OlderNewer