Skip to content

Instantly share code, notes, and snippets.

View mloberg's full-sized avatar
🐚
call me on my #!/bin/sh phone

Matt Loberg mloberg

🐚
call me on my #!/bin/sh phone
View GitHub Profile
import sys
import fcntl
LOCK_EX = fcntl.LOCK_EX
LOCK_SH = fcntl.LOCK_SH
LOCK_NB = fcntl.LOCK_NB
class Flock(object):
@mloberg
mloberg / Guardfile
Last active August 29, 2015 14:00
guard-jekyll
require 'jekyll'
module ::Guard
class Jekyll < Guard
def start
puts "Starting Jekyll on port #{port}"
options = ::Jekyll.configuration({:serving => true, :watch => true, :port => port})
p = ::Process.fork do
::Jekyll::Commands::Build.process(options)
::Jekyll::Commands::Serve.process(options)
@mloberg
mloberg / FreshCutDark.tmTheme
Created May 22, 2014 18:45
FreshCut Dark - SublimeText Theme
<!--
======================================================================
FreshCut Dark - Based on FreshCut by Dayle Rees
======================================================================
A Sublime Text 2 / Textmate theme.
Copyright (c) 2012 Dayle Rees.
Released under the MIT License <http://opensource.org/licenses/MIT>
----------------------------------------------------------------------
Find more themes at : https://github.com/daylerees/colour-schemes
----------------------------------------------------------------------
@mloberg
mloberg / flickr.php
Created October 21, 2014 16:31
Display Flickr photos
<?php
$id = '30065870@N08'; // Find your Flickr ID at http://idgettr.com
$url = 'http://api.flickr.com/services/feeds/photos_public.gne?id='.$id.'&format=json';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
curl_close($ch);
// Remove jsonp callback (jsonFlickrFeed) and escaped characters (except ")
@mloberg
mloberg / nginx.conf.erb
Created March 12, 2015 01:19
Boxen PHP Project Module
<%# modules/common/templates/nginx.conf.erb %>
# Example template for PHP-FPM based projects
#
# The template which nginx uses within a boxen::project can be overridden
# to a specific template such as this one.
#
# You will likely need to change both the root and SCRIPT_FILENAME parameters below
# to match your setup
#
server {
/**
* @fileOverview Form collection handler
*
* @author Matthew Loberg
*/
define(function(require, module, exports) {
'use strict';
var $ = require('jquery');
@mloberg
mloberg / contact.php
Created February 28, 2011 17:26
Contact Form
<?php
// get a recaptcha api key at http://www.google.com/recaptcha/whyrecaptcha
require_once("path/to/recaptchalib.php");
$publickey = "";
$privatekey = "";
// see if the form has been submitted
if($_POST['submit']){
// error checking
$errors = '';
@mloberg
mloberg / postmark.php
Created September 23, 2011 13:55
Postmark PHP Library
<?php
/**
* Send emails with Postmark (http://postmarkapp.com)
*
* Author: Matthew Loberg
* Author Twitter: @mloberg
* Author Website: http://mloberg.com
*/
@mloberg
mloberg / Popcorn.SourceCode.js
Created November 14, 2011 17:13
Popcorn Source Code Plugin
/**
* Popcorn SourceCode Plugin v0.1
* http://mattwritescode.com/2011/11/popcorn-source-code-plugin/
*
* Copyright 2011 Matthew Loberg (http://mloberg.com)
* Licensed under the MIT license
*
* Description:
* Add source code pre/code element to the page.
* If Google Code Prettify <http://code.google.com/p/google-code-prettify/>
@mloberg
mloberg / aacinfo.rb
Created December 8, 2011 19:31
AACInfo - Ruby
##
# Name: AACInfo
# Author: Matthew Loberg
# Author URL: http://twitter.com/mloberg
# Description:
# I couldn't get MP4Info to read the tags of my iTunes music files, so I created this little class.
# It uses faad to get the tag info, so make sure it's installed (brew install faad2)
require 'iconv'
class AACInfo