Skip to content

Instantly share code, notes, and snippets.

@DeanMarkTaylor
DeanMarkTaylor / post-menu-private-message-button.js
Last active August 29, 2015 14:15
Discourse - Add "Private Message" Post Button
// Show Private Message button (for specific categories)
// NOTE: In order for the button to display you need to 'message' to the post_menu site setting.
(function (require, Discourse, I18n, Em) {
var Button = require('discourse/views/post-menu').Button;
Discourse.PostMenuView.reopen({
buttonForMessage: function (post) {
// NOTE: just set whiteListedCategories to null / empty array to make buttons visible everywhere.
var whiteListedCategories = [37, 71, 72, 73, 74, 75, 76, 77, 78],
currentUser = Discourse.User.current();
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../paper-progress/paper-progress.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../yt-video/yt-search-video.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../core-pages/core-pages.html">
@DeanMarkTaylor
DeanMarkTaylor / chem.php
Created December 19, 2013 05:28
Expanding Chemical Equations - my answer to StackOverflow question: http://stackoverflow.com/questions/20670653/php-function-to-expand-chemical-equations
<?php
class chem_expand {
protected $multiplier;
function compute_bracketed_replacement( $groups ) {
// In-case if invalid input, output "<error>" in string.
$result = '<error>';
// If we have "(Chem)Multiplier"
@DeanMarkTaylor
DeanMarkTaylor / fullscreen.html
Created December 12, 2013 01:41
Copy of HTML5 Full-screen demo http://html5-demos.appspot.com/static/fullscreen.html modified to add support for testing IE. Specifically adds onload handler to test entering full-screen as soon as page loads.
<!DOCTYPE html>
<!--
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
.outer {
width: 50px;
height: 72px;
overflow:hidden;
-webkit-transform: translateZ(0);
}
.hi {
width: 500px;
height: 72px;
background-image: url("http://files.simurai.com/misc/sprite.png");
.outer {
width: 50px;
height: 72px;
overflow:hidden;
}
.hi {
width: 500px;
height: 72px;
background-image: url("http://files.simurai.com/misc/sprite.png");
-webkit-animation: play .8s steps(10) infinite;
.hi {
width: 50px;
height: 72px;
background-image: url("http://files.simurai.com/misc/sprite.png");
animation: play .8s steps(10) infinite;
}
@keyframes play {
from { background-position: 0px; }
to { background-position: -500px; }
@DeanMarkTaylor
DeanMarkTaylor / dabblet.css
Created September 25, 2013 17:06 — forked from LeaVerou/dabblet.css
Attempt for Chrome-style progress-indicator with SVG and CSS animations
/**
* Attempt for Chrome-style progress-indicator with SVG and CSS animations
*/
@keyframes spin {
to {
stroke-dashoffset: -264;
}
}
@DeanMarkTaylor
DeanMarkTaylor / domain_mapping.php - fix-php-notices-warnings.patch
Created April 8, 2013 23:34
WordPress MU Domain Mapping - 0.5.4.3 - Patch - Fix PHP notices and warnings
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 694026)
+++ domain_mapping.php (working copy)
@@ -370,7 +370,7 @@
exit;
break;
}
- } elseif( $_GET[ 'action' ] == 'delete' ) {
+ } elseif ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' ) {
@DeanMarkTaylor
DeanMarkTaylor / domain_mapping.php - fix-theme-customize.patch
Created April 8, 2013 23:33
WordPress MU Domain Mapping - 0.5.4.3 - Patch - Fix for theme preview not working
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 694026)
+++ domain_mapping.php (working copy)
@@ -695,7 +695,7 @@
return;
// don't redirect theme customizer (WP 3.4)
- if ( isset( $_POST['customize'] ) && isset( $_POST['theme'] ) && $_POST['customize'] == 'on' )
+ if ( isset( $_POST['wp_customize'], $_POST['theme'] ) && $_POST['wp_customize'] == 'on' )