This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Copyright (c) 2016 Matthew Loberg | |
# Distributed under the MIT License (http://opensource.org/licenses/MIT) | |
# | |
# ========================== | |
# Manage PHP (uses Homebrew) | |
# ========================== | |
# | |
# Commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm () { | |
[ -n "$NODE_VERSION" ] || NODE_VERSION="latest" | |
tty= | |
tty -s && tty=--tty | |
docker run \ | |
$tty \ | |
--interactive \ | |
--rm \ | |
--user $(id -u):$(id -g) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('lastfm.php'); | |
$lastfm = new LastFm('your-api-key'); | |
$params = array( | |
'user' => 'mloberg' | |
); | |
print_r($lastfm->call('user.getInfo', $params)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directory = './tmp/' | |
# ajax upload | |
if params[:qqfile].class == String | |
name = params[:qqfile] | |
string_io = request.body | |
data_bytes = string_io.read | |
path = File.join(directory, name) | |
File.open(path, "w") do |f| | |
f.write(data_bytes) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import islice, chain | |
def batch(iterable, size): | |
iterator = iter(iterable) | |
for first in iterator: | |
yield chain([first], islice(iterator, size - 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="watermark.php?watermark=watermark.png&src=test.jpg" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am mloberg on github. | |
* I am mloberg (https://keybase.io/mloberg) on keybase. | |
* I have a public key ASDcFyl0kafbvzkZ9nI-2-9d5Kk5XQMLUTnjNRw5p5s_DAo | |
To claim this, I am signing this object: |