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
@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 / example.php
Created March 10, 2011 19:27
A simple Postmark PHP Class
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
if($postmark->to("reciver@example.com")->subject("Email Subject")->plain_message("This is a plain text message.")->send()){
echo "Message sent";
}
@mloberg
mloberg / index.php
Created April 18, 2011 20:40
Last.fm Simple PHP Class
<?php
include_once('lastfm.php');
$lastfm = new LastFm('your-api-key');
$params = array(
'user' => 'mloberg'
);
print_r($lastfm->call('user.getInfo', $params));
@mloberg
mloberg / watermark.html
Created June 23, 2011 18:40
Watermark PHP
<img src="watermark.php?watermark=watermark.png&src=test.jpg" />
@mloberg
mloberg / jquery.loader.js
Created June 29, 2011 20:05
Simple jQuery Plugin Loader
(function($){
$.load = function(options){
// check for something to load
if(options.src === undefined) return;
// load dependencies
if(options.deps !== undefined){
$.each(options.deps, function(key, value){
var type = value.split(".")[value.split(".").length - 1];
if(type === "js"){
$.getScript(value);
@mloberg
mloberg / mysql.php
Created August 30, 2011 18:00
Simple PHP MySQL Class
<?php
class Mysql{
static private $link = null;
static private $info = array(
'last_query' => null,
'num_rows' => null,
'insert_id' => null
);
@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 / File.Upload.js
Created November 6, 2011 04:23
MooTools Ajax File Upload
/*
name: [File.Upload, Request.File]
description: Ajax file upload with MooTools.
license: MIT-style license
author: Matthew Loberg
requires: [Request]
provides: [File.Upload, Request.File]
credits: Based off of MooTools-Form-Upload (https://github.com/arian/mootools-form-upload/) by Arian Stolwijk
@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