Skip to content

Instantly share code, notes, and snippets.

View jasny's full-sized avatar

Arnold Daniels jasny

View GitHub Profile
@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 / 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 / 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 / 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 / FooController.php
Last active July 11, 2018 16:05
Jasny Framework MVC
<?php
class FooController extends Controller
{
/**
* @var FooGateway
*/
protected $foos;
/**
@jasny
jasny / gist:453fcd74045d74559f4c04ad1938c36f
Last active September 14, 2017 14:03
Rinkeby address - Main account
0xfEBDC084cA75b7d053D22b93644d9D9A012f7859
@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 / 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 / aws-setup.md
Created November 9, 2015 19:47
A simple guide on installing the AWS cli including how to obtain an access key

AWS cli

Installation

To use the AWS and Elastic Beanstalk command line application, you need to install them using the Python package installer pip.

sudo pip install awscli awsebcli

Creating access keys

@jasny
jasny / static-redirect-wordpress.php
Created June 28, 2015 12:18
Add redirects to WordPress posts using static HTML pages
<?php
/* This script can to be used when your replacing your WordPress site with
* a static site, while keeping your blog on WordPress.
*
* Make sure you increase the number of syndicated posts to include all posts
* in Settings > Reading on your WordPress blog.
*/
if ($argc < 2) {