Skip to content

Instantly share code, notes, and snippets.

View jasny's full-sized avatar

Arnold Daniels jasny

View GitHub Profile
@jasny
jasny / phpbrew-php.sh
Created April 2, 2017 21:58
phpbrew-php automatically runs the correct PHP version for a project
#!/bin/bash
# phpbrew-php will determine the PHP version of the project from the NetBeans project or composer.json.
command_exists () {
type "$1" &> /dev/null ;
}
vergte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
@jasny
jasny / README.md
Last active August 14, 2018 10:50
New PHP library

Jasny {{library}}

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight BCH compliance Packagist Stable Version Packagist License

@jasny
jasny / gist:453fcd74045d74559f4c04ad1938c36f
Last active September 14, 2017 14:03
Rinkeby address - Main account
0xfEBDC084cA75b7d053D22b93644d9D9A012f7859
@jasny
jasny / FooController.php
Last active July 11, 2018 16:05
Jasny Framework MVC
<?php
class FooController extends Controller
{
/**
* @var FooGateway
*/
protected $foos;
/**
@jasny
jasny / sha256-hmac.md
Last active December 12, 2023 12:32
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@jasny
jasny / magic_8_ball.php
Last active May 11, 2023 11:05 — forked from happy-box/magic_8_ball.py
Simple magic 8-ball game written in PHP
#!/usr/bin/env php
<?php
/**
* Magic 8 Ball IRC bot
* Created by Lance Brignoni
* Converted to PHP by Arnold Daniels
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
@jasny
jasny / livecontract-yaml-to-json.php
Created June 13, 2019 17:04
Script to convert Live Contract scenario Yaml to JSON
<?php
$file = $argv[1];
$tagToStruct = function($value, $tag) {
$key = substr($tag, 1);
return ["<$key>" => $value];
};
$callbacks = [
@jasny
jasny / gen.php
Last active July 6, 2020 14:21
rfc:strict_operators - Generate every combination of operands and operators
<?php
$one = [
'arithmetic' => ['+$a', '-$a'],
'bitwise' => ['~$a'],
'incdec' => ['++$a', '--$a'],
'logical' => ['!$a'],
];
$two = [
@jasny
jasny / poc-standard.php
Created June 26, 2019 07:16
Proof of concept where `strict_types` affects `==` and `!=` operators
<?php
var_dump("1" == 1);
var_dump("1" != 1);
@jasny
jasny / Email.php
Created September 4, 2019 10:52
Use Twig with PHPMailer
<?php
/**
* Render and send e-mail
*/
class Email extends PHPMailer
{
/**
* @var Twig_Environment
*/