Skip to content

Instantly share code, notes, and snippets.

View colinodell's full-sized avatar

Colin O'Dell colinodell

View GitHub Profile
@colinodell
colinodell / portVarKeywords.php
Last active September 28, 2016 12:24 — forked from nikic/portAlternativeTags.php
Tool for changing "var" keywords to "public" in PHP
<?php
/*
* Note: This script will directly modify the .php files in the given directory.
* It is assumed that the code is under version control, so you can easily review
* the changes using `git diff` or similar.
*/
function usageError() {
die("Usage: php portVarKeywords.php dir/\n");
@colinodell
colinodell / CustomParagraphRenderer.php
Created February 6, 2017 14:40
CommonMark - Overriding default renderers
<?php
use League\CommonMark\Block\Element\AbstractBlock;
use League\CommonMark\ElementRendererInterface;
class CustomParagraphRenderer implements BlockRendererInterface
{
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
{
return $htmlRenderer->renderInlines($block->children());
@colinodell
colinodell / .gitignore
Last active March 13, 2017 07:42
Standard Magento .gitignore
# Don't include any temporary files and other unimportant things
*.log
*.bak
*.bak.*
*.thumbs/
.DS_Store
Thumbs.db
.svn
*.swp
<?php
class TargetBlankLinkProcessor implements DocumentProcessorInterface
{
/**
* @param Document $document
*
* @return void
*/
public function processDocument(Document $document)
@colinodell
colinodell / changes.diff
Last active August 19, 2017 20:44
openzwave "dev" branch support for HA 0.50.2+
diff --git a/Dockerfile b/Dockerfile
index f0d5acc..fa6e914 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,6 +31,12 @@ COPY requirements_all.txt requirements_all.txt
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet
+# Install python-openzwave
+RUN pip3 install --upgrade cython==0.24.1 && \
@colinodell
colinodell / Dockerfile
Created October 12, 2017 19:39
Home Assistant with up-to-date Z-Wave files
FROM homeassistant/home-assistant:latest
RUN set -e && \
apt update && \
apt install -y unzip && \
wget -O /tmp/ozw.zip https://github.com/OpenZWave/open-zwave/archive/master.zip && \
cd /tmp && \
unzip /tmp/ozw.zip && \
cp -R /tmp/open-zwave-master/config/* /usr/local/lib/python3.6/site-packages/python_openzwave/ozw_config/ && \
rm -rf /tmp/ozw.zip /tmp/open-zwave-master && \
@colinodell
colinodell / patch-01-requirements.diff
Created May 22, 2017 02:48
Custom open-wave build for Home Assistant 0.45 on Docker
diff --git a/requirements_all.txt b/requirements_all.txt
index 6141e3d..2da4ce0 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -695,9 +695,6 @@ python-vlc==1.1.2
# homeassistant.components.wink
python-wink==1.2.4
-# homeassistant.components.zwave
-python_openzwave==0.4.0.31
@colinodell
colinodell / data.json
Last active October 30, 2017 04:16
Elephpants in JSON format
{
"2014-11-27-black-amsterdamphp": {
"name": "MurPHPy",
"variation": "AmsterdamPHP",
"species": "Elephpas hypertextus amstelodami",
"color": "black",
"sponsor": "AmsterdamPHP",
"reverse": "AmsterdamPHP logo",
"photos": [
{
@colinodell
colinodell / .gitconfig
Created March 19, 2018 14:36
Git Aliases
[alias]
p = "!git pull --ff-only"
fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autostash --autosquash $REV^' -
cleanup = "!git branch --merged | grep -v -P '^\\*|master|develop' | xargs -n1 -r git branch -d"
children = "!bash -c 'c=${1:-HEAD}; set -- $(git rev-list --all --not \"$c\"^@ --children | grep $(git rev-parse \"$c\") ); shift; echo $1' -"

My Solutions for https://returntrue.win

  1. !0
  2. str_rot13
  3. !0
  4. 0
  5. 🤷 (any emoji should work)
  6. ???
  7. (object)[!0]
  8. new class extends Bar{}