Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.7.1-revrelease at 2017-10-30T12:14:57.765Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT2H32M53.000S" maxSegmentDuration="PT0H0M4.000S" profiles="urn:mpeg:dash:profile:full:2011">
<ProgramInformation moreInformationURL="http://gpac.io">
<Title>footballsm_dash.mpd generated by GPAC</Title>
</ProgramInformation>
<Period duration="PT2H32M53.000S">
<AdaptationSet segmentAlignment="true" maxWidth="704" maxHeight="576" maxFrameRate="25" par="16:9" lang="und">
<ContentComponent id="1" contentType="video" />
@laverboy
laverboy / logback.xml
Created March 17, 2017 12:22
Simplified logback settings for test
<!-- https://www.playframework.com/documentation/latest/SettingsLogger -->
<configuration>
<!-- Suppress logback complaining about multiple logback.xml files -->
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!-- We use short exception stack trace logging to limit output for travis. -->
import scala.util.parsing.json.JSON
import scalaj.http.Http
// Assumes a list of objects. If response i only as single object, the last
// .asInstanceOf[Seq[Map[String, Any]]] could be changed to .asInstanceOf[Map[String, Any]]
def getService(serviceURL: String, serviceAuthToken: String): Seq[Map[String, Any]] = {
JSON.parseFull(
Http(serviceURL)
.timeout(connTimeoutMs = 600000, readTimeoutMs = 10000)
@laverboy
laverboy / LogUse.php
Last active June 4, 2024 06:56
A simple, static, logging singleton class
<?php
Log::info("something really interesting happened", ['extra' => 'information', 'about' => 'anything' ]);
@laverboy
laverboy / DashboardWidget.php
Last active August 29, 2015 14:27
Singleton Pattern for functions.php
<?php namespace CharityPress\Functions;
/**
* Enqueue scripts and styles.
*/
class DashboardWidget extends Singleton {
//required function
public function init() {
add_action( 'wp_dashboard_setup', [ $this, 'intro_widget' ] );
@laverboy
laverboy / config.php
Created June 8, 2015 08:04
Dot Notation Accessor
<?php
return [
'version' => '1.0.0',
'table' => 'table_name',
'info' => [
'item' => [
'name' => 'cherry',
'value' => 'pick'
]
@laverboy
laverboy / dyn_vhosts.conf
Created October 7, 2014 18:19
Dynamic Vhosts
NameVirtualHost *:80
<VirtualHost *:80>
UseCanonicalName Off
ServerName vhosts.local.reasondigital.com
ServerAlias *
VirtualDocumentRoot /Users/mlaver/Projects/%1/htdocs/
Options All ExecCGI FollowSymLinks +Includes
</VirtualHost>
@laverboy
laverboy / gist:b86485e1806d3cba6a8f
Last active August 29, 2015 14:02
Update Wordpress with new server name in sql
update table_name set option_value = replace(option_value,"oldurl.com","newurl.com");
@laverboy
laverboy / image-replacement.js
Last active November 27, 2016 06:11
Javascript Image Replacement technique in Wordpress
// --------------------------------
// load images from their data-src
// --------------------------------
// - pure javascript
for (var i = document.querySelectorAll('[data-src]').length - 1; i >= 0; i--) {
var image = document.querySelectorAll('[data-src]')[i];
image.src = image.getAttribute('data-src');
};
// - jQuery
$('[data-src]').each(function (){
@laverboy
laverboy / createTemplateFromObject.js
Last active December 27, 2015 16:39
Really simple javascript templating. Input is html string and data object.
function createTemplateFromObject(template, data) {
var t = '';
// For each item in the object, make the necessary replacement
for (key in data) {
console.log(key, data);
reg = new RegExp('{{' + key + '}}', 'ig');
t = (t || template).replace(reg, data[key]);
}