Skip to content

Instantly share code, notes, and snippets.

Jamie York ziadoz

Block or report user

Report or block ziadoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ziadoz
ziadoz / log-errors.js
Created Dec 11, 2019
Log JS Errors via AJAX
View log-errors.js
// On error send to backend route which will log error into central logging service.
window.onerror = function(message, file, line) {
fetch(
'/log/js-error',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
@ziadoz
ziadoz / run-ansible.sh
Created Dec 4, 2019
Run Ansible Playbook Against Host
View run-ansible.sh
# Replace [IP], [USER], [KEY] and [PLAYBOOK]
# Comma after IP address is required, otherwise the command won't work.
ansible-playbook -i [IP], --user=[USER] --private-key=[KEY] [PLAYBOOK]
@ziadoz
ziadoz / main.go
Last active Sep 1, 2019
Download a webpage as HTML with base64 encoded assets using Golang
View main.go
// Usage: go run main.go https://www.theguardian.com/uk
// Based on Monolith: https://github.com/Y2Z/monolith
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
@ziadoz
ziadoz / readme.md
Created Aug 30, 2019
Cloning Github Gists
View readme.md

Cloning Github Gists

To clone a gist:

git clone git@gist.github.com:[GIST ID].git

If you need to add a remote to an existing repository:

git remote add origin git@gist.github.com:[GIST ID].git
@ziadoz
ziadoz / .php_cs.dist
Last active Aug 8, 2019
PHP CS Fixer Configuration
View .php_cs.dist
<?php declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->path('.php_cs.dist')
->in(__DIR__);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
@ziadoz
ziadoz / gists.go
Created Jul 26, 2019
Test Golang API Client Using httptest Package
View gists.go
package gists
import (
"encoding/json"
"fmt"
"net/http"
)
type Api struct {
client *http.Client
@ziadoz
ziadoz / game-save-clean-up.go
Created May 26, 2019
Clean Up Game Save Manager Folders
View game-save-clean-up.go
// Usage: game-save-clean-up --src="/Files/Game Saves" [--limit=2] [--dryrun]
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@ziadoz
ziadoz / fizzbuzz.go
Last active Dec 24, 2017
FizzBuzz in Go
View fizzbuzz.go
package main
import "fmt"
const (
FIZZ = 3
BUZZ = 5
FIZZBUZZ = 15
)
@ziadoz
ziadoz / setup.md
Created Jul 22, 2017
Using XDebug in Atom Editor
View setup.md

Using XDebug in Atom Editor

Install the XDebug plugin for Atom and then add the following to the config.cson file (Atom > Config…):

"php-debug":
  PathMaps: [
    "remotepath;localpath"
    "/server/path/to/project/;/local/path/to/project/"
  ]
  ServerPort: 9001
@ziadoz
ziadoz / install.sh
Last active Jul 22, 2017
Install Atom Editor PHP Integrator Core 3.0.0 on macOS Sierra
View install.sh
#!/usr/bin/env bash
brew tap homebrew/homebrew-php
brew install php71
cd ~/.atom/packages/php-integrator-base/core
/usr/local/bin/php ./composer.phar create-project php-integrator/core ./3.0.0 3.0.0 --prefer-dist --no-dev
You can’t perform that action at this time.