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 / 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 / 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 / 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)
import sys
import fcntl
LOCK_EX = fcntl.LOCK_EX
LOCK_SH = fcntl.LOCK_SH
LOCK_NB = fcntl.LOCK_NB
class Flock(object):
@mloberg
mloberg / gist:5469030
Last active December 16, 2015 17:18
Append a gitignore template to your local .gitignore.
#!/usr/bin/env python
import os
import sys
import fcntl
import termios
import struct
import urllib2
import json
GITIGNORE_URL = "https://api.github.com/gitignore/templates"
@mloberg
mloberg / com.gitlab.gitlab.plist
Created December 3, 2012 16:19
Gitlab LaunchD Startup Script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/Cellar/ruby/1.9.3-p125/bin:/usr/local/share/npm/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/share/npm/bin:/usr/local/sbin:/usr/X11/bin:/Users/gitlab/.rvm/bin</string>
</dict>
<key>KeepAlive</key>
@mloberg
mloberg / redis.php
Created October 18, 2012 18:06
PHP Redis Class
<?php
class Redis {
const CRLF = "\r\n";
private $connection;
/**
* Create a new instance of the class.
@mloberg
mloberg / sifter.php
Created October 4, 2012 20:51
PHP Sifter API Class
<?php
/**
* A simple PHP class to interact with the Sifter API.
*/
class Sifter
{
/**
* Sifter account hostname (example.sifterapp.com)
@mloberg
mloberg / gist:3750653
Created September 19, 2012 16:35
Find file in git based on md5 checksum.
#!/bin/sh
CHECKSUM=$1
FILE=$2
if [[ -z "$CHECKSUM" ]]; then
echo "Usage: $0 md5 file"
exit 1
elif [[ -z "$FILE" ]]; then
echo "Usage: $0 md5 file"
@mloberg
mloberg / .vimrc
Created September 14, 2012 17:04
"Don't think about using arrow keys in vim
noremap <Up> :q!<Enter>
noremap! <Up> <Esc>:q!<Enter>
noremap <Down> :q!<Enter>
noremap! <Down> <Esc>:q!<Enter>
noremap <Left> :q!<Enter>
noremap! <Left>