Skip to content

Instantly share code, notes, and snippets.

def valid_json_only(json_string)
begin
return false unless json_string.is_a?(String)
JSON.parse(json_string)
rescue JSON::ParserError
false
end
end
@ryanburnette
ryanburnette / rb_temp_public_preview_fix.php
Last active August 29, 2015 14:03
A temporary fix for the Public Preview WordPress plugin's issue with permalink structure. Add this to functions.php for a quick fix.
function rb_temp_public_preview_fix() {
?>
<script>
jQuery(document).ready(function($) {
'use strict';
var ppFix
, $field
, q
, postId
def suffix_filename(filename, suffix)
extension = File.extname(filename)
filename.reverse.sub(extension.reverse, ("#{suffix}#{extension}").reverse).reverse
end
function slugify(str) {
return str
.toLowerCase()
.replace(/[^\w ]+/g,'')
.replace(/ +/g,'-')
;
}
/* global _gaq */
(function ($) {
'use strict';
if ( typeof(_gaq) === 'undefined' ) {
return false;
}
var $forms
, slugify
/* global Modernizr */
var fixNoBackgroundSize = function () {
var bg2img
;
bg2img = function ($el) {
var bg
, classes
, $r
;
svg.switch2inline = function () {
var switcher
;
switcher = function ($el) {
var src
, classes
, $replacement
, guid
, s
# /etc/fail2ban/jail.conf
[wordpress]
enabled = true
port = http,https
filter = wordpress-auth
logpath = /var/log/nginx/access.log
maxretry = 3
bantime = 3600
var getPagesSegment
;
(function(){
'use strict';
var get
;
get = {};
path = "/srv/app"
environment "production"
workers 1
threads 0,8
bind "unix://#{path}/current/tmp/sockets/puma.sock"
pidfile "#{path}/current/tmp/pids/puma.pid"
state_path "#{path}/current/tmp/states/puma.state"
stdout_redirect "#{path}/current/log/stdout", "#{path}/current/log/stderr"