Skip to content

Instantly share code, notes, and snippets.

Eric Teubert eteubert

Block or report user

Report or block eteubert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ex_bench.ex
start = System.monotonic_time(:millisecond)
foo = testme()
time_spent = System.monotonic_time(:millisecond) - start
IO.puts("Executed testme() in #{time_spent} #{:millisecond}")
@eteubert
eteubert / tasks.json
Last active Feb 13, 2019
VS Code: Task to run Elixir tests
View tasks.json
{
"version": "2.0.0",
"tasks": [{
"group": {
"kind": "test",
"isDefault": true
},
"label": "elixir: run stale tests",
"type": "shell",
"command": "mix test --stale",
@eteubert
eteubert / default.twig
Created Oct 22, 2018
Podlove Publisher Default Template
View default.twig
{% if not is_feed() %}
{# display web player for episode #}
{{ episode.player }}
{# display contributors if module is active #}
{% if shortcode_exists("podlove-episode-contributor-list") %}
{# see http://docs.podlove.org/podlove-publisher/reference/shortcodes.html#contributors for parameters #}
[podlove-episode-contributor-list]
{% endif %}
{% endif %}
@eteubert
eteubert / progress.ex
Created Jul 20, 2018
Elixir GenServer to render a progress bar
View progress.ex
defmodule Some.Progress do
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, %{total: 0, progress: 0}, name: __MODULE__)
end
def init(args) do
{:ok, args}
end
@eteubert
eteubert / adjustment.php
Last active May 17, 2018
Podlove Web Player 4 in Podlove Publisher: Hide Share Tab
View adjustment.php
<?php
add_filter('podlove_player4_config', function ($config) {
$config['visibleComponents'] = [
'tabInfo',
'tabChapters',
'tabDownload',
'tabAudio',
// 'tabShare',
'poster',
'showTitle',
@eteubert
eteubert / episode_controller.ex
Created Apr 3, 2018
Filter / Params in Phoenix Controllers
View episode_controller.ex
defmodule NeulandWeb.Admin.EpisodeController do
use NeulandWeb, :controller
alias Neuland.Repo
alias Neuland.Directory
alias Neuland.Directory.EpisodeParams
@episodes_per_page 100
def index(conn, %{"filter" => filter_params}) do
@eteubert
eteubert / podlove_set_rewrite.php
Created Feb 3, 2018
Podlove Publisher: Set "rewrite" argument for Custom Post Type to `true` for compatibility with “The SEO Framework”
View podlove_set_rewrite.php
<?php
add_filter('podlove_post_type_args', function ($args) {
$args['rewrite'] = true;
return $args;
});
@eteubert
eteubert / podlove-podcast-total-duration.twig
Last active Dec 7, 2016
Template für Podlove Podcast Publisher. Gesamtdauer aller Episoden.
View podlove-podcast-total-duration.twig
{% set total = 0 %}
{% for episode in podcast.episodes %}
{% set total = total + episode.duration.totalMilliseconds %}
{% endfor %}
{# // is division and then rounding down (floor) #}
{% set hours = total // (1000 * 3600) %}
{% set minutes = (total // (1000 * 60)) % 60 %}
{% set seconds = (total // 1000) % 60 %}
@eteubert
eteubert / db-open
Created Nov 7, 2016 — forked from helderco/db-open
Script to open a mysql database in Sequel Pro from a service in docker-compose.
View db-open
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@eteubert
eteubert / wordpress-passwort-reset-unmultisite.php
Last active May 23, 2019
Multisite: Passwort Reset on Local Blog
View wordpress-passwort-reset-unmultisite.php
<?php
/**
* Plugin Name: Multisite: Passwort Reset on Local Blog
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process.
* Version: 1.0.0
* Author: Eric Teubert
* Author URI: http://ericteubert.de
* License: MIT
*/
You can’t perform that action at this time.