Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
<?php
/**
* spellcheck.php
*
* @version 0.1
* @author Emil Hernvall <[email protected]>
* @license Public Domain
*/
/**
<?php
# http://darklaunch.com/2009/08/07/base58-encode-and-decode-using-php-with-example-base58-encode-base58-decode
#################################################################
function base58_encode($num) {
$alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$base_count = strlen($alphabet);
$encoded = '';
<?php
/**
* Simple SocketServer that runs over the udp protocol. The run method takes a callable
* which is called with the data received.
*
* @package Socket
*/
class SocketServer
{
#!/usr/bin/php
<?php
/**
* Checks a list of domains and outputs any that use Google.
*
* usage: php ./googlecheck.php filewithdomains
*
*/
stream_set_blocking(STDIN, 0);
<?php
/*
* to-markdown - an HTML to Markdown converter for PHP
*
* Copyright 2013, Blake Turner
* Licenced under the MIT licence
*
*/
<pre>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$host = '127.0.0.1';
$user = 'root';
$pass = '';
$db = 'test';
<?php
# Need Composer with PHPUnit
require 'vendor/autoload.php';
function cantor($x, $y)
{
// ((x + y) * (x + y + 1)) / 2 + y;
return bcadd(bcdiv(bcmul(bcadd($x, $y), bcadd(bcadd($x, $y), 1)), 2), $y);
}
function super_json_decode($json, &$value, $assoc = false, $depth = 512, $options = 0) {
$pValue = false;
$result = json_decode($json, $assoc, $depth);
if(json_last_error() == JSON_ERROR_NONE) {
$pValue = $result;
return true;
}
return false;
}
<?php
/**
* A simple class to read variable byte length binary data.
* This is basically is a better replacement for unpack() function
* which creates a very large associative array.
*
* @author Shubham Jain <[email protected]>
* @example https://github.com/shubhamjain/PHP-ID3
* @license MIT License
<?php
class GoogleTranslate {
public $lastResult = "";
private $langFrom;
private $langTo;
private static $urlFormat = "http://translate.google.com/translate_a/t?client=t&text=%s&hl=en&sl=%s&tl=%s&ie=UTF-8&oe=UTF-8&multires=1&otf=1&pc=1&trs=1&ssel=3&tsel=6&sc=1";
public function __construct($from = "en", $to = "ka") {