Skip to content

Instantly share code, notes, and snippets.

View cr0ybot's full-sized avatar
🤖

Cory Hughart cr0ybot

🤖
View GitHub Profile
@cr0ybot
cr0ybot / config.rb
Last active August 29, 2015 14:06 — forked from nathansmith/config.rb
preferred_syntax = :scss
http_path = '/'
css_dir = 'css'
sass_dir = 'scss'
images_dir = 'img'
javascripts_dir = 'js'
fonts_dir = 'fonts'
relative_assets = true
@cr0ybot
cr0ybot / Gruntfile.js
Last active August 29, 2015 14:23 — forked from jshawl/Gruntfile.js
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('grunt-postcss')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: false
@cr0ybot
cr0ybot / functions.php
Created August 30, 2017 13:51
Add style formats to WordPress editor dropdown
function my_mce_before_init_insert_formats( $init_array ) {
$style_formats = array(
array(
'title' => 'Headline',
'block' => 'h2',
'classes' => 'headline',
'wrapper' => false,
),
array(
'title' => 'Blockquote',
@cr0ybot
cr0ybot / config.js
Created May 11, 2018 15:56
Parse JS SDK modifications for Titanium SDK
{
"global": {
"parse": {
"applicationId": "com.example.parseAppID",
"javascriptKey": "XXXX",
"clientKey": "YYYY",
"restAPIKey": "ZZZZ",
"serverURL": "https://example.com/parse/"
}
}
@cr0ybot
cr0ybot / sunrise.php
Last active December 11, 2023 16:27
WordPress Multisite Local/Staging/Live Dev Setup
<?php
/**
* File wp-content/sunrise.php
*
* This allows us to copy the production multisite database to staging/local and still use
* it directly without altering domains
*
* This file can be present on all copies of the site, but it should only be added to the
* wp-config file of local/staging (via `define( 'SUNRISE', true )`)
*
@cr0ybot
cr0ybot / mobilefix.js
Created March 30, 2019 17:07
Mobile 100vh fix (ES6 module)
/**
* MobileFix
*
* Fix fullheight elements on mobile with that pesky URL bar
*/
/**
* Threshold of screen height difference at which elements will update their
* height, so will essentially only update on orientation change.
* Change to 0 if you want elements to adjust every time URL bar moves
@cr0ybot
cr0ybot / .htaccess
Created September 6, 2019 19:00
WP local dev fetch images from staging
# Load uploads from staging server if they don't exist locally
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^example\.local$
RewriteRule ^wp-content/uploads/(.*)$ https://example.staging.com/wp-content/uploads/$1 [NC,L]
</IfModule>
# BEGIN WordPress
@cr0ybot
cr0ybot / README.md
Last active February 10, 2020 20:57
Titanium IcoMoon Font Icons

Titanium IcoMoon Font Icons

IcoMoon is a fantastic service for putting together a lean collection of custom icons in a single font file for use on the web and, now in a Titanium app!

  1. On the IcoMoon Generate tab, make sure that the glyphs are named how you want to access them in the app. For instance, a gear icon might be named "settings".
  2. Generate and download your font files. Place you IcoMoon TTF font file and the selection.json file into app/assets/fonts.
  3. Place icon.js into your app/lib/ folder.
@cr0ybot
cr0ybot / line-break.js
Created May 1, 2020 23:06
Gutenberg Line Break Format
/**
* Format: line break
*
* Adds a line break option to any Rich Text editor that adds a <br> tag
*/
const { __ } = wp.i18n;
const { insertObject, registerFormatType } = wp.richText;
const { RichTextToolbarButton } = wp.blockEditor;
@cr0ybot
cr0ybot / functions.php
Last active April 22, 2022 14:22
Fix WordPress current_page_parent for Blog and Custom Post Type Archive Menu Links
/**
* Checks the current page to see if current_page_parent should be removed from the blog link or added to a cpt archive pagelink
*/
function cr0ybot_cpt_menu_highlight( $classes, $item, $args ) {
// Remove current_page_parent from Blog if not on a post
$cpp = array_search( 'current_page_parent', $classes );
if ( $cpp !== false && $item->type === 'post_type' ) {
$qo = get_queried_object();
if ( ( $qo instanceof WP_Post && $qo->post_type !== 'post' ) ||