Skip to content

Instantly share code, notes, and snippets.

☎️
call me on my #!/bin/sh phone

Matthew Loberg mloberg

☎️
call me on my #!/bin/sh phone
Block or report user

Report or block mloberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mloberg
mloberg / index.php
Created Apr 18, 2011
Last.fm Simple PHP Class
View index.php
<?php
include_once('lastfm.php');
$lastfm = new LastFm('your-api-key');
$params = array(
'user' => 'mloberg'
);
print_r($lastfm->call('user.getInfo', $params));
@mloberg
mloberg / npm.sh
Created Apr 21, 2017
WIP: Run npm via Docker
View npm.sh
npm () {
[ -n "$NODE_VERSION" ] || NODE_VERSION="latest"
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
View irc.rb
require "socket"
class IRC
def initialize(info)
@server = info[:server]
@port = info[:port] || 6667
@password = info[:password]
@nick = info[:nick]
@channel = info[:channel]
@mloberg
mloberg / mphp
Created Oct 3, 2016
Bash script for managing PHP versions on macOS (using Homebrew)
View mphp
#!/usr/bin/env bash
#
# Copyright (c) 2016 Matthew Loberg
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
#
# ==========================
# Manage PHP (uses Homebrew)
# ==========================
#
# Commands:
@mloberg
mloberg / jquery.loader.js
Created Jun 29, 2011
Simple jQuery Plugin Loader
View jquery.loader.js
(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);
View comparison.php
<?php
function compareHashes($hashOne, $hashTwo)
{
$result = 0;
for ($i = 0; $i < strlen($hashOne); $i++) {
$charOne = substr($hashOne, $i, 1);
$charTwo = substr($hashTwo, $i, 1);
$intOne = base_convert($charOne, 16, 10);
@mloberg
mloberg / gist:5469030
Last active Dec 16, 2015
Append a gitignore template to your local .gitignore.
View gist:5469030
#!/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 Dec 3, 2012
Gitlab LaunchD Startup Script
View com.gitlab.gitlab.plist
<?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 Oct 18, 2012
PHP Redis Class
View redis.php
<?php
class Redis {
const CRLF = "\r\n";
private $connection;
/**
* Create a new instance of the class.
@mloberg
mloberg / sifter.php
Created Oct 4, 2012
PHP Sifter API Class
View sifter.php
<?php
/**
* A simple PHP class to interact with the Sifter API.
*/
class Sifter
{
/**
* Sifter account hostname (example.sifterapp.com)
You can’t perform that action at this time.