Skip to content

Instantly share code, notes, and snippets.

View floq-design's full-sized avatar

James Hobson floq-design

View GitHub Profile
@islandjoe
islandjoe / compile.sh
Last active July 18, 2020 16:37 — forked from adisuryadi/compile.sh
Run ES6 in Coderunner via Babel
#!/bin/bash
#
# This script will create transpile ES6 (with JSX) support in babel
# to ES5 that evaluatable in regular node.js
# Script will create a filename.out file, evaluates it, then remove the file.
#
# First off, you'll need Node.js.
#
# Steps:
# 1) Install babel globally npm install -g babel-cli
@ptim
ptim / SaveAs-UTF8.py
Created March 12, 2014 11:59
ST3 super simple plugin: Save the current file with encoding UTF8, then close.
import sublime, sublime_plugin
'''
A response to: http://stackoverflow.com/questions/19831757/how-to-create-macro-in-sublime-text-3-with-saveas-and-close-file-command
Save the current file with encoding UTF8, then close.
To trigger the command with 'Command Option Shift 8',
add the following to your Sublime Text > Preferences > Keybindings - User
@trovster
trovster / functions-general.php
Created April 19, 2012 10:18
My general checkbox meta box for the WordPress admin area. All custom fields prefix with custom_ are saved automatically with my update function.
<?php
function post_type_custom_fields_general_featured() {
global $post;
$custom = get_post_custom($post->ID);
$is_featured = is_custom_boolean($custom, 'custom_is_featured');
echo '<p class="checkbox" style="padding-top: 5px;">';
echo '<input type="hidden" name="custom_is_featured" value="false" />';
echo '<input style="margin-right: 5px;" id="custom_is_featured" value="true" type="checkbox" name="custom_is_featured"' . (($is_featured) ? ' checked="checked"' : '') . ' />';
@aarongustafson
aarongustafson / responsive-iframes.css
Created October 25, 2011 17:07
Responsive iFrames with jQuery
iframe {
max-width: 100%;
}
@kopischke
kopischke / markdown2evernote.rb
Created June 5, 2011 16:57
OS X service scripts
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)
@mjangda
mjangda / category_template_filter.php
Created January 12, 2010 13:07
Dynamically assigning custom category templates
<?php
// Inspired by a snippet by Justin Tadlock (http://justintadlock.com/) posted here: http://elliotjaystocks.com/blog/tutorial-multiple-singlephp-templates-in-wordpress/#comment-2383
add_filter( 'category_template', 'my_category_template' );
// I believe *_template hooks exist for just about every type of template so it's easy to apply to other templates as well
function my_category_template( $template ) {
if( is_category( 1 ) ) // We can search for categories by ID
$template = locate_template( array( 'template_id_A.php', 'category.php' ) );