Skip to content

Instantly share code, notes, and snippets.

mjc / DD32s-combine-plugin.php
Created December 5, 2008 04:38
WIP: Combine Javascript and CSS in wordpress
View DD32s-combine-plugin.php
Plugin Name: The Combiner
Plugin URI:
Description: Combine CSS & JS into one large monolithic file
Author: DD32
Version: 1.0
Author URI:
mjc / gist:37996785f47f565eb431dca19b56cf84
Created March 29, 2022 22:04
M1 macs: Preserving HDR, convert all mkv in a folder to 1080P using HandBrakeCLI. Uses VideoToolbox for hardware encoding.
View gist:37996785f47f565eb431dca19b56cf84
#!/usr/bin/env bash
read -r -d '' profile <<'EOF'
"PresetList" : [
"AlignAVStart" : true,
"AudioCopyMask" : [
mjc /
Last active October 21, 2019 22:06 — forked from mstroeck/
Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!
set -o errexit
# @TODO detect fd and fallback to find
pngs=$(fd -e png .)
jpgs=$(fd -e jpg .)
#pngs=$(find . -iname "*.png")
#jpgs=$(find . -iname "*.jpg")
optimize_a_png() {
mjc / fizz_buzz_test.exs
Last active July 13, 2019 14:53
test for fizzbuzz
View fizz_buzz_test.exs
defmodule FizzBuzzTest do
use ExUnit.Case
# to run tests: mix test
# to get an irb equivalent with your code loaded in it: iex -S mix
# to get a pry in your code: `require IEx;IEx.pry()`
# Phase 1: make the test pass.
# Phase 2: implement the fizz/buzz check as a pattern match
# Phase 3: move the pattern match into multiple function clauses.
mjc / iso8601_to_datetime.sql
Created November 28, 2012 23:17
MySQL function to convert from ISO8601 to DATETIME
View iso8601_to_datetime.sql
delimiter $$
' ',
SUBSTRING(iso, 12, 8)),
mjc /
Last active February 10, 2017 17:53 — forked from erikwennerberg/


Add the following gems to your Gemfile:

gem 'activeresource'
gem 'newrelic_api'

Update your bundle:

View gist:485383
Plugin Name: Get OSCommerce Cart Contents from session
Plugin URI:
Description: allows you to retrieve the cart contents from your OSCommerce install. Requires that your cookie path would include both OSC and wordpress. Works with OSCommerce 2.2RC2.
Author: Michael J. Cohen <>
Version: 1
Author URI:
mjc /
Last active January 3, 2016 06:09 — forked from ngs/ for running CakePHP apps under Pow. Includes an app/webroot rewrite and some other things from the rack-legacy example.
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
webroot = File.join(Dir.getwd,'app','webroot')
use Rack::Rewrite do
rewrite %r{/(.*)}, lambda { |match, rack_env|
File.exists?(File.join(webroot,match[1])) ? File.join('app','webroot',match[1]) : '/app/webroot/index.php/%s' % match[1]
mjc / activemerchant.gemspec.diff
Created July 30, 2013 17:11
trying to add fake extension to activemerchant to allow conditionally requiring nokogiri based on ruby version at gem install time
View activemerchant.gemspec.diff
index 652e40c..233d9df 100644
--- a/activemerchant.gemspec
+++ b/activemerchant.gemspec
@@ -13,8 +13,8 @@ do |s|
s.homepage = ''
s.rubyforge_project = 'activemerchant'
- s.files = Dir['CHANGELOG', '', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*']
- s.require_path = 'lib'
+ s.files = Dir['CHANGELOG', '', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*', 'ext/nokogiri_conf.rb']
mjc / gist:6029781
Created July 18, 2013 14:27
rbx error differences
View gist:6029781
class Moo
def self.moo
a = 50a
# require './moo.rb' in pry
# rbx:
# SyntaxError: /usr/local/rvm/rubies/rbx-head/runtime/melbourne.rbc:81: expecting keyword_end
# from /usr/local/rvm/rubies/rbx-head/runtime/melbourne.rbc:81:in `syntax_error'