Skip to content

Instantly share code, notes, and snippets.

Mark Williams mtrl

Block or report user

Report or block mtrl

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
@mtrl
mtrl / app.component.ts
Last active Jan 24, 2017
app.component.ts changes for logging
View app.component.ts
import {LoggerService} from ‘./logger-service’;
import {Logger} fromangular2-logger/core”;
@Component({
providers: [LoggerService, Logger]
})
@mtrl
mtrl / config.ts
Created Jan 24, 2017
sample.config.ts
View config.ts
export let data = {
"ApiUrl" : "http://my.dev",
"LogLevel": "DEBUG", // OFF, ERROR, WARN, INFO, DEBUG, LOG
"AnalyticsId": "UA-XXXX-XX",
"TermsBlerb": "Some TCs."
}
View Vagrantfile.rb
config.vm.provider 'virtualbox' do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end
View selectable.app.scss
.selectable {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
View jwt-filter.php
$this->loader->add_filter('validate_token', $plugin_public, 'validate_token’);
View rest-api-auth-hook
// Check for the existence of a header authentication token before dispatching any data
add_filter( 'rest_pre_dispatch', function() {
$requestPath = $_SERVER['REQUEST_URI'];
if($requestPath != '/wp-json/jwt-auth/v1/token') {
$tokenValidationResponse = apply_filters('validate_token', null);
if(gettype($tokenValidationResponse) == 'object' && get_class($tokenValidationResponse) == "WP_Error") {
foreach($tokenValidationResponse->error_data as $key => $error) {
$status = $error['status'];
$msg = $key;
};
@mtrl
mtrl / wordpress-permissions.sh
Created Apr 11, 2016
WordPress permissions for update
View wordpress-permissions.sh
sudo chown www-data:www-data -R *
sudo find . -type f -exec chmod 775 {} \; # Change file permissions
sudo find . -type d -exec chmod 775 {} \; # Change file permissions
# Switch them back to the correct permissions:
sudo find . -type f -exec chmod 755 {} \; # Change file permissions
sudo find . -type d -exec chmod 644 {} \; # Change file permissions
@mtrl
mtrl / ReleaseEvents.cs
Created Mar 14, 2016
ReleaseEvents.cs
View ReleaseEvents.cs
using Tridion.ContentManager.ContentManagement;
using Tridion.ContentManager.Extensibility;
using Tridion.ContentManager.Extensibility.Events;
using Tridion.ContentManager.CommunicationManagement;
using System;
using Tridion.ContentManager;
using System.IO;
using System.Web;
@mtrl
mtrl / transcode-video-for-chromecast.sh
Last active Jul 22, 2016
Transcode video for Chromecast
View transcode-video-for-chromecast.sh
VIDEO=[video]
ffmpeg -i $VIDEO -c:v libx264 -profile:v high -level 5 -crf 18 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -vf "scale=iw*sar:ih, scale='if(gt(iw,ih),min(1920,iw),-1)':'if(gt(iw,ih),-1,min(1080,ih))'" -x264opts bframes=3:cabac=1 -movflags faststart -strict experimental -c:a aac -b:a 320k -y $VIDEO.mp4
@mtrl
mtrl / Vagrantfile
Created Nov 2, 2015
Vagrant file for DD4T 2.0 vNext application
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
You can’t perform that action at this time.