Skip to content

Instantly share code, notes, and snippets.

View derekconjar's full-sized avatar

Derek Conjar derekconjar

View GitHub Profile
@derekconjar
derekconjar / wordpress-firebase.php
Last active April 25, 2024 15:21
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@derekconjar
derekconjar / _head.erb
Created May 3, 2014 16:22
An example of SEO for Middleman sites. Add data (like titles, meta descriptions, etc.) using YAML files and frontmatter, and use custom helpers to process the data and display them properly within your ERB layouts and partials.
<title><%= title_helper %></title>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<%= description_helper %>">
<link rel="canonical" href="<%= permalink_helper %>">
<link rel="author" href="<%= data.site.gplus %>">
<link rel="alternate" type="application/rss+xml" title="http://feeds.feedburner.com/derekconjar">
@derekconjar
derekconjar / config.rb
Created May 3, 2014 16:25
Custom page directories in Middleman. Keep different kinds of pages (like landing pages and reports) separate, but give them all pretty URLs.
page_dirs = ["pages", "landing", "reports"]
page_dirs.each do |page_dir|
pages = Dir.glob("./source/#{page_dir}/*.html*")
pages.each do |page_path|
pattern = /.\/source\/#{page_dir}\/([^\.]*)\..*/
page = page_path.match(pattern).captures[0]
@derekconjar
derekconjar / rock-paper-scissors.js
Last active July 16, 2016 00:37
RockPaperScissors - an overengineered and charmingly rude JavaScript rock paper scissors game that I wrote when I was bored.
;(function () {
var RockPaperScissors = function (opts) {
this.opts = opts ? opts : {};
this.scoreboard = [];
this.choices = [];
this.truthtable = this.opts.truthtable || {
rock: ['scissors'],
paper: ['rock'],