Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
ircmaxell / gist:1966809
Created March 3, 2012 16:03
Scalar Casting Patch, Version 3
Index: Zend/zend.h
===================================================================
--- Zend/zend.h (revision 323850)
+++ Zend/zend.h (working copy)
@@ -486,6 +486,10 @@
union _zend_function *__call;
union _zend_function *__callstatic;
union _zend_function *__tostring;
+ union _zend_function *__toint;
+ union _zend_function *__tofloat;
@ircmaxell
ircmaxell / Expressions.php
Created September 21, 2011 16:51
A math parser and evaluator implementation
<?php
class Parenthesis extends TerminalExpression {
protected $precidence = 6;
public function operate(Stack $stack) {
}
public function getPrecidence() {
return $this->precidence;
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
double get_time()
{
struct timeval t;
struct timezone tzp;
gettimeofday(&t, &tzp);
@ircmaxell
ircmaxell / php_zpp.php
Last active March 1, 2023 23:48
Zend Parse Parameters. In PHP
<?php
namespace ZPP;
const IS_STRING = "string";
const IS_BOOL = "boolean";
const IS_LONG = "integer";
const IS_DOUBLE = "double";
const IS_ARRAY = "array";
const IS_OBJECT = "object";
@ircmaxell
ircmaxell / php-build.sh
Created July 8, 2012 16:58
PHP Build Script
#!/bin/bash
function checkError {
if [ $1 -ne 0 ]; then
echo -e "Error in build step\n"
exit
fi
}
VERSION=$1
@ircmaxell
ircmaxell / example.php
Created September 6, 2013 13:38
JSON utility class
<?php
require 'json.php';
$json = new JSON;
$json->foo->bar->baz = "foo";
$json->foo->biz = "test";
$json->baz = array();
$json->baz[1] = "testing";
<?php
$url = 'https://qa-orderapi.intelispend.com/Processes/IntelispendAPI/IntelispendOrderAPI/SubmitFileService.serviceagent?wsdl';
$opts = array(
'http' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
$context = stream_context_create($opts);
$client = new \SoapClient($url,
@ircmaxell
ircmaxell / php.sh
Created July 8, 2012 17:15
PHP Run Script
#!/bin/bash
BIN=""
if [ "$PHP" == "/usr/local/bin/php" ]
then
PHP=""
fi
BIN="/usr/local/php/$1/bin/php"
@ircmaxell
ircmaxell / password.php
Created June 18, 2012 16:53
Password API Example
<?php
define('PASSWORD_SHA256', '$5$');
define('PASSWORD_SHA512', '$6$');
define('PASSWORD_BCRYPT', '$2y$');
define('PASSWORD_SCRYPT', '$7$'); // made up here
$password_algos = array();
function password_register_algo($prefix, Callable $create, Callable $validate) {
@ircmaxell
ircmaxell / equality.php
Last active April 19, 2019 13:52
Unicode Set Functions
<?php
const ✓ = true;
const ✕ = false;
function ≠($left, $right) {
return $left != $right;
}
function ≅($left, $right) {