Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
NaN

Kieron rwarasaurus

🤖
NaN
View GitHub Profile
View Preferences.sublime-settings
{
"auto_complete": false,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"color_scheme": "Packages/One Dark Color Scheme/One Dark.tmTheme",
"draw_white_space": "all",
"fade_fold_buttons": false,
"fold_buttons": true,
"font_face": "Fira Mono",
@rwarasaurus
rwarasaurus / quantbet-dev-challenge.php
Created Mar 24, 2017
QuantBet Developer Challenge
View quantbet-dev-challenge.php
<?php
require __DIR__ . '/vendor/autoload.php';
$client = new \GuzzleHttp\Client();
$jar = new \GuzzleHttp\Cookie\CookieJar();
$res = $client->request('GET', 'http://quantbet.com/quiz/dev', [
'cookies' => $jar,
]);
View rules.md

Code Style Guide

PHP

  • Features that have been added in version 7 should be evident in code submitted.
    • Scalar type declarations
    • Return type declarations
    • Null coalescing operator
  • Code will be formated using the PSR-2 standard
  • Functions will not be indented more than 3 times and less than 100 lines.
@rwarasaurus
rwarasaurus / WowzaSecureToken.php
Created Oct 11, 2016
PHP WowzaSecureToken Class for Wowza Streaming Engine 4.5
View WowzaSecureToken.php
<?php
class WowzaSecureToken {
protected $prefix = '';
protected $secret = '';
protected $client = '';
@rwarasaurus
rwarasaurus / setup.sh
Last active May 25, 2016
nginx setup
View setup.sh
mv /etc/nginx /etc/nginx.old
mkdir /etc/nginx
mkdir /etc/nginx/ssl
mkdir /etc/nginx/snippets
mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled
wget http://snipet.co.uk/1q/raw -O /etc/nginx/nginx.conf
wget http://snipet.co.uk/LtP/raw -O /etc/nginx/mime.types
wget http://snipet.co.uk/hLr/raw -O /etc/nginx/snippets/php.conf
@rwarasaurus
rwarasaurus / install.sh
Last active Nov 29, 2016
server setup on aws ec2 debian 8.3
View install.sh
apt update
apt upgrade -y
apt install git curl software-properties-common -y
echo 'deb http://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list
echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list.d/dotdeb.list
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
@rwarasaurus
rwarasaurus / imap.php
Last active Oct 25, 2016
php imap wrapper
View imap.php
<?php
class Imap {
protected $dns;
protected $user;
protected $pass;
@rwarasaurus
rwarasaurus / nginx.conf
Last active Feb 23, 2018
mopidy port 80 proxy pass with nginx on raspberry pi
View nginx.conf
server {
listen 80 default_server;
server_name _;
location / {
proxy_buffering off;
proxy_pass http://127.0.0.1:6680;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
View multibyte-unserialize.php
<?php
function mb_unserialize($string) {
$string = preg_replace_callback('#s:\d+:"(.*?)";#s', function($matches) { return sprintf('s:%d:"%s";', strlen($matches[1]), $matches[1]); }, $string);
return unserialize($string);
}
View MemcacheCollection.php
<?php
class MemcacheCollection {
protected function getIndexes() {
$result = $this->instance->get('collection_indexes');
return json_decode($result);
}