Skip to content

Instantly share code, notes, and snippets.

View saltandvinegarcrisps's full-sized avatar
🤖
NaN

Kieron saltandvinegarcrisps

🤖
NaN
View GitHub Profile
{
"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",
@saltandvinegarcrisps
saltandvinegarcrisps / quantbet-dev-challenge.php
Created March 24, 2017 23:00
QuantBet Developer Challenge
<?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,
]);

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.
@saltandvinegarcrisps
saltandvinegarcrisps / WowzaSecureToken.php
Created October 11, 2016 12:21
PHP WowzaSecureToken Class for Wowza Streaming Engine 4.5
<?php
class WowzaSecureToken {
protected $prefix = '';
protected $secret = '';
protected $client = '';
@saltandvinegarcrisps
saltandvinegarcrisps / setup.sh
Last active May 25, 2016 10:36
nginx setup
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
@saltandvinegarcrisps
saltandvinegarcrisps / install.sh
Last active November 29, 2016 15:45
server setup on aws ec2 debian 8.3
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
@saltandvinegarcrisps
saltandvinegarcrisps / imap.php
Last active October 25, 2016 16:16
php imap wrapper
<?php
class Imap {
protected $dns;
protected $user;
protected $pass;
@saltandvinegarcrisps
saltandvinegarcrisps / nginx.conf
Last active February 23, 2018 21:12
mopidy port 80 proxy pass with nginx on raspberry pi
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";
<?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);
}
<?php
class MemcacheCollection {
protected function getIndexes() {
$result = $this->instance->get('collection_indexes');
return json_decode($result);
}