Skip to content

Instantly share code, notes, and snippets.

View abackstrom's full-sized avatar

Annika Backstrom abackstrom

View GitHub Profile
@abackstrom
abackstrom / git-url.php
Created November 7, 2012 21:47
git-url: display github urls on the command line
#!/bin/env php
<?php
//
// Save to your path as git-url.
//
// Display GitHub URLs for your current branch and last commit:
//
// git url
//
@abackstrom
abackstrom / module.js
Created October 28, 2020 16:09
TiddlyWiki wikirule for JIRA ticket links
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "jiralink";
exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
this.matchRegExp = new RegExp(/[A-Z]+-\d+/, "mg");
@abackstrom
abackstrom / php.vim.patch
Created November 12, 2019 21:34
Basic patch for syntax/php.vim support of "flexible" heredoc
--- a/syntax/php.vim 2018-11-30 16:50:41.000000000 +0000
+++ b/syntax/php.vim 2019-11-12 21:23:05.870740817 +0000
@@ -379,18 +379,18 @@
syn case match
" HereDoc
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
+syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\I\i*\)\2$" end="^\s*\z1\(;\=$\)\@=" contained contains=phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
" including HTML,JavaScript,SQL even if not enabled via options
-syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)\2$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
@abackstrom
abackstrom / GitHub_URL.php
Created January 19, 2012 16:54
Fetch short URL using git.io
<?php
class GitHub_URL {
protected $long;
public function __construct( $url ) {
$this->long = $url;
}
public function long() {
@abackstrom
abackstrom / exercise-equivalent-binary-trees.go
Last active February 26, 2018 20:10
My solution for Go Tour Concurrency Exercise "Equivalent Binary Trees"
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
package main
// Pinout https://forums.ni.com/legacyfs/online/202279_Main%20Pinout.png
// Pibrella (Python) https://github.com/pimoroni/pibrella/blob/master/library/pibrella/__init__.py
// go-rpio https://github.com/stianeikeland/go-rpio/blob/master/rpio.go
import (
"fmt"
"github.com/stianeikeland/go-rpio"
"os"
@abackstrom
abackstrom / gist.go
Last active February 24, 2018 18:06
This gist was created by the gisted code. Self-gisting! This is the first complete Go program I've ever written.
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
@abackstrom
abackstrom / Makefile
Created November 2, 2010 09:45
CSS and JavaScript Minification/Compression Makefile
#
# css/js minification/compression makefile
#
#
# JS_TARGETS -- js files to minify/gzip
# CSS_TARGETS -- css files to minify/gzip
# CLEANUP -- additional files to delete during "make clean"
#
@abackstrom
abackstrom / novel
Last active June 30, 2017 16:40
PHP: Using a child process for text transformations without blocking
Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people’s hats off—then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, s

Keybase proof

I hereby claim:

  • I am abackstrom on github.
  • I am abackstrom (https://keybase.io/abackstrom) on keybase.
  • I have a public key ASD-ihbCAkm3yzj2QzyXcSMqQnEdaWv96J_SYtaF1AXlzwo

To claim this, I am signing this object: