Skip to content

Instantly share code, notes, and snippets.

View dougbeal's full-sized avatar

Douglas Beal dougbeal

View GitHub Profile
function auto_approve_bridgy_comments($approved, $commentdata) {
return strpos($commentdata['comment_agent'], 'Bridgy (https://brid.gy/about) AppEngine-Google') !== false ? 1 : $approved;
}
add_filter('pre_comment_approved', 'auto_approve_bridgy_comments', '99', 2);
<?php
/*
Default Template
* The Goal of this Template is to be a general all-purpose model that will be replaced by customization in other templates
*/
$kind = get_post_kind_slug( get_the_ID() );
$meta = new Kind_Meta( get_the_ID() );
$author = Kind_View::get_hcard( $meta->get_author() );
$cite = $meta->get_cite();

Keybase proof

I hereby claim:

  • I am dougbeal on github.
  • I am murderofcrows (https://keybase.io/murderofcrows) on keybase.
  • I have a public key ASBRT2_bdU4um4Lw_Qiud-fMwSMBsNpvJPSIcNhLfXm_eQo

To claim this, I am signing this object:

@dougbeal
dougbeal / Optional+Empty.swift
Created June 4, 2016 04:24 — forked from irace/Optional+Empty.swift
`UITextView` should really just have this by default.
protocol TextContaining {
var isEmpty: Bool { get }
}
extension String: TextContaining {
}
extension Optional where Wrapped: TextContaining {
var isEmpty: Bool {
switch self {
@dougbeal
dougbeal / find-duplicate-files.rb
Created January 2, 2016 22:17 — forked from ma11hew28/find-duplicate-files.rb
Ruby script that finds identical (md5) files in all subdirectories (recursive)
require 'digest/md5'
hash = {}
Dir.glob("**/*", File::FNM_DOTMATCH).each do |filename|
next if File.directory?(filename)
# puts 'Checking ' + filename
key = Digest::MD5.hexdigest(IO.read(filename)).to_sym
if hash.has_key? key
@dougbeal
dougbeal / delete_unplayed.coffee
Created October 26, 2014 00:42
Delete unplayed episodes from feed page for overcast.fm
#developed/run from chrome CoffeeScript console
for cell in $('.usernewepisode')
cellid = cell.href.split('/').slice(-1)
delete_url = "https://overcast.fm/podcasts/delete_item/#{cellid}"
console.log delete_url
window.open delete_url, "_blank"
@dougbeal
dougbeal / extract_htmlurl_feedl.sh
Created October 23, 2014 21:47
Extract htmlUrl from feedly opml file using sed
#!/bin/sh
sed -n 's/.*htmlUrl="\([^"]*\)".*/\1/p' feedly.opml
@dougbeal
dougbeal / .emacs.el
Created April 26, 2013 23:01
Cross platform .emacs file to load configuration from repository
(require 'cl)
(defun load-init-file ()
(let* (
(user (getenv "USER"))
(repo "/git/home")
(locations
(list
(concat "/Users/" user repo)
(concat "/home/" user repo)
(concat "C:/cygwin/home/" user repo )