This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Latest Post Redirect | |
This page template will redirect to your latest post. | |
Simply create a new page and set the template as "Latest Post Redirect". | |
For specific categories, see http://codex.wordpress.org/Function_Reference/wp_get_recent_posts. | |
*/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function remove_admin_bar() { | |
if (!current_user_can("administrator")) { | |
show_admin_bar(false); | |
} | |
} | |
public static function redirect_if_not_admin() { | |
if (!current_user_can("administrator")) { | |
wp_redirect( site_url() ); | |
exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var browserify = require('browserify'), | |
source = require('vinyl-source-stream'), | |
buffer = require('vinyl-buffer'), | |
uglify = require('gulp-uglify'), | |
gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
minifyCSS = require('gulp-minify-css'), | |
gulpif = require('gulp-if'), | |
rename = require('gulp-rename'), | |
stringify = require('stringify'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Redirect | |
*/ | |
if ($post->post_content != "") { | |
$url = wp_strip_all_tags($post->post_content); | |
} else if (!$post->post_parent) { | |
$children = get_pages("child_of=".$post->ID."&sort_column=menu_order"); | |
$url = get_permalink($children[0]->ID); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
/** | |
* Search and Replace on a MySQL DB that has PHP serialized fields. | |
* By Dallas Read, 2015. | |
*/ | |
$host = isset($argv[1]) ? $argv[1] : false; | |
$user = isset($argv[2]) ? $argv[2] : false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'shellwords' | |
username = "me" | |
filetype = ".pdf" | |
target = "/Users/#{username}/Desktop/pdfs" | |
source = "/Users/#{username}/Library/Messages/Attachments/**/*#{filetype}" | |
Dir[source].each do |file| | |
basename = File.basename(file) | |
`cp #{file} #{target.shellescape}/#{basename.shellescape}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Generate = require('generate-js'), | |
events = require('events'), | |
Bars = require('bars'), | |
bars = new Bars(); | |
function removeEmptyObjects(data) { | |
for (var key in data) { | |
if (data[key]) { | |
if (typeof data[key] === 'object') { | |
if (data[key] instanceof Array) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Big-Enough Text Area | |
// @version 4 | |
// @grant none | |
// @match https://github.com/* | |
// ==/UserScript== | |
(function () { | |
document.body.innerHTML += ` | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHubCommenter | |
// @version 1 | |
// @grant none | |
// @match https://dnsimple.com/admin* | |
// ==/UserScript== | |
class Commenter { | |
constructor($target, namespace, repo) { | |
this.repo = repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name KeywordFinder | |
// @version 1 | |
// @grant none | |
// @match https://news.ycombinator.com/* | |
// ==/UserScript== | |
(function(keyword) { | |
const counter = document.createElement('p') | |
counter.style.position = 'fixed' |
OlderNewer