Skip to content

Instantly share code, notes, and snippets.

@mjc
mjc / gist:765198
Created January 4, 2011 18:52
bug in id3v2 handling, lyrics removed from paste for brevity
id3v2 tag info for 09 Like The Weather.mp3:
UFID (Unique file identifier): http://musicbrainz.org, 36 bytes
TIT2 (Title/songname/content description): Like The Weather
TPE1 (Lead performer(s)/Soloist(s)): 10,000 Maniacs
TALB (Album/Movie/Show title): MTV Unplugged
TCON (Content type): Folk Rock (255)
TRCK (Track number/Position in set): 09/14
TYER (Year): 1993
USLT (Unsynchronized lyric/text transcription): ()[eng]:
TXXX (User defined text information): (ALBUMARTISTSORT): 10,000 Maniacsss
/****************************************************
Author: Brian J Clifton
Url: http://www.advanced-web-metrics.com
This script is free to use as long as this info is left in
DESCRIPTION: Script for tracking regional and custom search engines. Requires ga.js
READ: http://www.advanced-web-metrics.com/blog/2008/09/14/customising-the-list-of-search-engines-in-google-analytics/
All scripts presented have been tested and validated by the author and are believed to be correct
as of the date of publication or posting. The Google Analytics software on which they depend is
@mjc
mjc / Makefile
Created June 27, 2012 03:56
Example Q&D makefile. untested.
CFLAGS="-g -Wall"
DEPS="foo.o bar.o baz.o"
TARGET=progname
.PHONY: clean all
$(TARGET): $(DEPS)
$(CXX) -o $(TARGET) $(CFLAGS) $(CXXFLAGS) $(DEPS)
@mjc
mjc / bench.rb
Created November 20, 2015 22:06 — forked from jurre/bench.rb
roar vs ams
require "bundler"
require "active_model_serializers"
require "roar"
require "roar/json/json_api"
require "benchmark"
require "ffaker"
Post = Struct.new(:id, :author, :body, :draft) do
include ActiveModel::Serializers::JSON
end

Keybase proof

I hereby claim:

  • I am mjc on github.
  • I am projct (https://keybase.io/projct) on keybase.
  • I have a public key ASD4cqm9IEAT8sbSVfLXVPJNRFi66uua7_7BHZEToAf9WAo

To claim this, I am signing this object:

@mjc
mjc / jetpack-status.php
Created April 5, 2013 16:16
Super Quick PHP Script to print out status information for the Verizon MiFi JetPack 5510L
#!/usr/bin/env php
<?php
$statusurl = 'http://my.jetpack/srv/status';
/*
returned data looks like this:
array(
'notificationFlag' => 1,
'statusBarActivityVisible' => 1,
@mjc
mjc / gist:6029403
Created July 18, 2013 13:43
fix for HTTParty in rbx 2.0 mode
diff --git a/lib/20/net/http.rb b/lib/20/net/http.rb
index fd8c802..2266617 100644
--- a/lib/20/net/http.rb
+++ b/lib/20/net/http.rb
@@ -321,7 +321,7 @@ module Net #:nodoc:
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
# HTTPRedirection:: 3xx
- # HTTPMultipleChoice:: 300
+ # HTTPMultipleChoices:: 300
@mjc
mjc / gist:6029781
Created July 18, 2013 14:27
rbx error differences
class Moo
def self.moo
a = 50a
end
end
# 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'
@mjc
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
index 652e40c..233d9df 100644
--- a/activemerchant.gemspec
+++ b/activemerchant.gemspec
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
s.homepage = 'http://activemerchant.org/'
s.rubyforge_project = 'activemerchant'
- s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*']
- s.require_path = 'lib'
+ s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*', 'ext/nokogiri_conf.rb']
@mjc
mjc / config.ru
Last active January 3, 2016 06:09 — forked from ngs/config.ru
config.ru 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]
}