Skip to content

Instantly share code, notes, and snippets.

View eteubert's full-sized avatar

Eric Teubert eteubert

View GitHub Profile
@eteubert
eteubert / xml_generate_tag.php
Created August 11, 2020 14:59
Generate a single XML element (for example for an RSS feed). Much better than doing it by hand as it ensures the text content is valid / escaped.
<?php
$doc = new DOMDocument();
$node = $doc->createElement("itunes:summary");
// either one is fine, both generate valid XML
// $text = $doc->createTextNode('I am <foo> example & so');
$text = $doc->createCDATASection('I am <foo> example & so');
$node->appendChild($text);
$doc->saveXML($node);
@eteubert
eteubert / v3.0.0-changelog.md
Created July 22, 2020 11:40
Preliminary Release Notes for Podlove Publisher v3.0

Podlove Publisher v3.0 Release Notes

Breaking Changes

  • requires PHP 7.0 (or newer)
  • requires WordPress 5.2 (or newer)
  • Web Player:
    • removes Podlove Web Player 2
    • removes Podlove Web Player 3
  • removes "insert player automatically" option (probably does not affect anyone as the web player is by default inserted via template)
@eteubert
eteubert / unstuck.md
Created August 30, 2019 08:32
ElixirLS + VSCode -- what to do if stuck
  1. Set elixirLS.fetchDeps to false
  2. Check that elixirLS.projectDir is set to .
  3. Close VSCode
  4. rm -rf deps _build .elixir_ls && mix deps.get
  5. Start VSCode

extracted from JakeBecker/elixir-ls#71

@eteubert
eteubert / limit.js
Created December 2, 2011 10:39
WordPress: Comment Length Limiter
jQuery(function($) {
// configure
var comment_input = $( '#commentform textarea' );
var submit_button = $( '#commentform .form-submit' );
var comment_limit_chars = 1000;
// stop editing here
// display how many characters are left
$( '<div class="comment_limit_info"><span>' + comment_limit_chars + '</span> characters left</div>' ).insertAfter( comment_input );
@eteubert
eteubert / mp4chaps_to_psc.php
Created November 20, 2012 21:27
mp4chaps to PSC converter
<?php
namespace Podlove;
/**
* Chapter management class.
* Consumes mp4chaps and spits out valid psc xml.
*
* @see http://podlove.org/simple-chapters/
*/
class Chapters {
start = System.monotonic_time(:millisecond)
foo = testme()
time_spent = System.monotonic_time(:millisecond) - start
IO.puts("Executed testme() in #{time_spent} #{:millisecond}")
@eteubert
eteubert / gist:1426544
Created December 3, 2011 08:26
Blue Yeti
- my machine: MacBook Pro with Mac OS X Lion (currently 10.7.2)
- When I connect the Yeti to any of the USB ports of my MacBook Pro, the Mute light shines red but that's all
- not recognized in the "Sound" panel: http://cl.ly/1Y1O2B2j0H0f1C2K1o0z
- does not appear in the "Audio Devices" panel either: http://cl.ly/3y3F0T2U4046202Z0q03
- tried all USB slots
- directly plugged in, no USB hub
- tried rebooting
- tried different USB cable
- no other devices connected to the MBP
- tried with 3 different Lion Macs: the aforementioned MBP, a MacBook and a MacBook air - same symptoms everywhere
@eteubert
eteubert / tasks.json
Last active February 13, 2019 01:22
VS Code: Task to run Elixir tests
{
"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 October 22, 2018 10:53
Podlove Publisher Default Template
{% 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 July 20, 2018 09:05
Elixir GenServer to render a progress bar
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