Skip to content

Instantly share code, notes, and snippets.

View adrian-green's full-sized avatar

Adrian Green adrian-green

View GitHub Profile
@adrian-green
adrian-green / Image.php
Last active March 21, 2016 06:52
bad code
<?php
@adrian-green
adrian-green / gist:376553b56068144c94d3331094daf72d
Created March 16, 2017 06:47 — forked from discordier/gist:ed4b9cba14652e7212f5
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@adrian-green
adrian-green / SimpleStore.js
Created July 20, 2017 01:15
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve:
@adrian-green
adrian-green / README.md
Created December 11, 2017 23:30 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@adrian-green
adrian-green / generate_magento_urn_to_xsd_mapping.php
Created February 17, 2018 04:54 — forked from Flyingmana/generate_magento_urn_to_xsd_mapping.php
a script to easily add a config to map all the magento URNs to their actual files in a project
<?php
/**
* license is MIT, you will find the text of it in the internet
*/
echo "start generation script\n";
function getAllSchemaFilePaths()
{
@adrian-green
adrian-green / install
Created May 15, 2018 02:53 — forked from mfrister/install
Fix Ubuntu VMs not suspending in VMware Fusion
# Paste into a root shell on your Ubuntu VM
curl -L https://gist.githubusercontent.com/meeee/5e252e93ba4589e67cf3/raw/faa25d74545ca527d713df2b843da43af3cf92ea/network > /etc/init.d/network && \
chmod +x /etc/init.d/network && \
echo "Suspend fix installed."
@adrian-green
adrian-green / README.rst
Created September 20, 2018 00:57 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

<?php
/*
usage: php document.php --ext name [--output document.txt]
*/
function prototype(Reflector $reflector) {
$elements = [];
switch (get_class($reflector)) {
case "ReflectionClass":
if ($reflector->isFinal()) {
#!/bin/bash
#Repo directory name
FNAME=${PWD##*/}
#Latest tag (release)
TAG=`git describe --abbrev=0 --tags`
#Create zip archive named after repo and tag, containing repo contents @HEAD
git archive -9 --prefix $FNAME/ HEAD -o ../$FNAME-$TAG.zip

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.