Skip to content

Instantly share code, notes, and snippets.


Steve B meadsteve

View GitHub Profile
CODE = "def say_message(message):;0;1print(message);0say_message('hello')"
exec(CODE.replace(";0", "\n").replace(";1", "\t"))
meadsteve /
Last active Sep 9, 2020
Constrained types in python
class NonEmptyList(list, Generic[T]):
def __init__(self, *members: T):
def _validate_constraints(self):
if len(self) < 1:
raise RuntimeError("NonEmptyList must have at least one member")
meadsteve /
Last active Aug 1, 2019 — forked from henriklindgren/
Unpack dict based on pydantic BaseModel into model
#This is free and unencumbered software released into the public domain.
#Anyone is free to copy, modify, publish, use, compile, sell, or
#distribute this software, either in source code form or as a compiled
#binary, for any purpose, commercial or non-commercial, and by any
#In jurisdictions that recognize copyright laws, the author or authors
#of this software dedicate any and all copyright interest in the
#software to the public domain. We make this dedication for the benefit
meadsteve / Dockerfile
Last active Apr 2, 2019 — forked from philcross/Dockerfile
docker example
View Dockerfile
FROM php:7.3-fpm
WORKDIR /var/www/html
ENV COMPOSER_HOME=/usr/local/share/composer

Keybase proof

I hereby claim:

  • I am meadsteve on github.
  • I am meadsteve ( on keybase.
  • I have a public key whose fingerprint is C00A D434 70A0 113C EF31 8E28 6B08 AFC9 C001 CE6F

To claim this, I am signing this object:

View extensionhelper.js
var CheckMessageForKeyword = function(message, keyword, hasParameters) {
if (! || ! {
return null;
var keywordRegex;
if (hasParameters) {
keywordRegex = new RegExp("^\\s*" + keyword + "\\s*(\\S.+?)\\s*$", "i");
var params =;
meadsteve / clock.ex
Created Sep 30, 2015 — forked from CrowdHailer/clock.ex
Creating boundary modules for elixir applications. These have their implementation set during the configuration step. In this example we switch clock between system clock and a dummy clock
View clock.ex
# This module represents a behaviour and when used picks from the Application configuration which implementation will be used
defmodule Clock do
@callback now() :: Integer.t
defmacro __using__([]) do
module = Application.get_env(:my_app, :Clock)
quote do
alias unquote(module), as: Clock
meadsteve / example.php
Last active Aug 26, 2015
Api !== Http
View example.php
class Api {
const SUCCESS = 0;
const FAILURE = 13;
public function doThingOne($SomeArgument)
// do something
return self::SUCCESS;
View downloader.exs
#!/usr/bin/env elixir
defmodule Committer do
defstruct [:name, :email]
def list(repo) do
|> from_repo
|> Stream.unfold(fn str ->
case String.split(str, "\n", parts: 2, trim: true) do
meadsteve / oops.js
Last active Aug 29, 2015
unicode vs javascipt coder sanity
View oops.js
var a‌a = "first assignment";
aa = "second assignment";
console.log(a‌a == aa);