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 save_and_resample($fname, $oname, $tname, $type, $imagew, $imageh) | |
{ | |
$imgr = ( $imagew > $imageh ) ? IMAGE_MAX_THUMB_WIDTH/$imagew : IMAGE_MAX_THUMB_HEIGHT/$imageh ; | |
$neww = $imagew * $imgr; | |
$newh = $imageh * $imgr; | |
$fulw = $imagew; | |
$fulh = $imageh; | |
if ( $neww > IMAGE_MAX_THUMB_WIDTH ) { |
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
/* | |
* patches the req object to have the pause() and resume() functions | |
* for event buffering (for async middleware). | |
* code is take from express' utils file | |
*/ | |
const http = require('http'), | |
req = http.IncomingMessage.prototype; | |
// patch req object for async middleware |
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
/** | |
* Taken from http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/ | |
*/ | |
Array.prototype.find = function (needle, comparator) { | |
var low = 0, | |
high = this.length - 1, | |
i, | |
comparison; | |
while (low <= high) { | |
i = Math.floor((low + high) / 2); |
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
#!/usr/bin/env node | |
const fs = require('fs'); | |
var args = process.argv.slice(2); | |
if (args.length < 2) { | |
console.log('Usage: jsonv <jsonfile> <json-path-1> ... <json-path-n>'); | |
process.exit(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 | |
function b58_to_dec($val) { | |
return gmp_strval(gmp_init((string) $val, 58), 10); | |
} | |
function b58_to_hex($val) { | |
return gmp_strval(gmp_init((string) $val, 58), 16); | |
} | |
function dec_to_b58($val) { |
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 previewImage(file) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
var o = $('<img class="img">').attr('src', e.target.result), | |
r = $('.img-box'); | |
o.load(function (e) { | |
r.append(o); | |
var h = o.height(), |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div><span id="host1">mysql-a</span>.protego.com</div> | |
<div><span id="host2">mysql-a</span>.protego.com</div> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
.edit { | |
padding-left: 18px; | |
background: #ff6 url(http://www.famfamfam.com/lab/icons/silk/i |
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
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700); | |
/*---------------- | |
* control styles | |
*/ | |
body { | |
color: #333; | |
font-size: 14px; | |
line-height: 19px; |
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 | |
include './fmt.php'; | |
$text = ''; | |
if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') | |
$text = $_POST['text']; | |
?> | |
<!DOCTYPE html> | |
<html> |
OlderNewer