Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Working on league/commonmark 2.0!

Colin O'Dell colinodell

💻
Working on league/commonmark 2.0!
View GitHub Profile
@colinodell
colinodell / BeepExtension.php
Created Sep 14, 2020
Make PHPUnit beep at you any time a test fails
View BeepExtension.php
<?php declare(strict_types=1);
namespace Vendor;
use PHPUnit\Runner\AfterTestErrorHook;
final class BeepExtension implements AfterTestErrorHook
{
public function executeAfterTestError(string $test, string $message, float $time): void
{
@colinodell
colinodell / packagist-counter.ino
Created Jan 27, 2020
Packagist download count - firmware
View packagist-counter.ino
// This #include statement was automatically added by the Particle IDE.
#include "LedControl-MAX7219-MAX7221/LedControl-MAX7219-MAX7221.h"
#include <math.h>
LedControl lc=LedControl(D6,D4,D5,1);
int count = 0;
int lastCount = 0;
int downloadsPerInterval = 1;
View solutions.md

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{}
View .gitconfig
[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' -"
@colinodell
colinodell / Dockerfile
Created Oct 12, 2017
Home Assistant with up-to-date Z-Wave files
View Dockerfile
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 / data.json
Last active Oct 30, 2017
Elephpants in JSON format
View data.json
{
"2014-11-27-black-amsterdamphp": {
"name": "MurPHPy",
"variation": "AmsterdamPHP",
"species": "Elephpas hypertextus amstelodami",
"color": "black",
"sponsor": "AmsterdamPHP",
"reverse": "AmsterdamPHP logo",
"photos": [
{
@colinodell
colinodell / changes.diff
Last active Aug 19, 2017
openzwave "dev" branch support for HA 0.50.2+
View changes.diff
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 && \
View TargetBlankLinkProcessor.php
<?php
class TargetBlankLinkProcessor implements DocumentProcessorInterface
{
/**
* @param Document $document
*
* @return void
*/
public function processDocument(Document $document)
@colinodell
colinodell / patch-01-requirements.diff
Created May 22, 2017
Custom open-wave build for Home Assistant 0.45 on Docker
View patch-01-requirements.diff
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 / CustomParagraphRenderer.php
Created Feb 6, 2017
CommonMark - Overriding default renderers
View CustomParagraphRenderer.php
<?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());