Skip to content

Instantly share code, notes, and snippets.

Avatar
🐚
call me on my #!/bin/sh phone

Matt Loberg mloberg

🐚
call me on my #!/bin/sh phone
View GitHub Profile
View lock.py
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 Aug 29, 2015
guard-jekyll
View Guardfile
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
FreshCut Dark - SublimeText Theme
View FreshCutDark.tmTheme
<!--
======================================================================
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 Oct 21, 2014
Display Flickr photos
View flickr.php
<?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 Mar 12, 2015
Boxen PHP Project Module
View nginx.conf.erb
<%# 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 {
View FormCollectionView.js
/**
* @fileOverview Form collection handler
*
* @author Matthew Loberg
*/
define(function(require, module, exports) {
'use strict';
var $ = require('jquery');
View contact.php
<?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 Sep 23, 2011
Postmark PHP Library
View postmark.php
<?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 Nov 14, 2011
Popcorn Source Code Plugin
View Popcorn.SourceCode.js
/**
* 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/>
View aacinfo.rb
##
# 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