Skip to content

Instantly share code, notes, and snippets.

@ma11hew28
ma11hew28 / Tile Images.jsx
Created November 21, 2010 16:47
Photoshop script to tile images for iPhone Photo Scroller
// Photoshop Script to Resize & Tile Images
//
// WARNING!!! This script will overwrite (delete perminently) files in the
// selected output folder in the rare case that there are name collisions.
// Therefore, to be safe, it's best to choose an empty output folder.
//
// Copyright (c) 2010 Matt Di Pasquale
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ma11hew28
ma11hew28 / gist:641363
Created October 22, 2010 21:00
Address standardization via USPS Webtools API
require 'rubygems'
require 'nokogiri'
require 'open-uri'
module USPS
SERVER = "http://production.shippingapis.com/ShippingAPITest.dll"
USERNAME = 'username-here' # username from http://www.usps.com/webtools/
class Address
# requres ruby-1.9, which keeps hashes ordered
require 'rubygems'
require 'ruby-debug'
require 'gdata'
require 'pp'
SPREADSHEET_FEED = 'https://spreadsheets.google.com/feeds/spreadsheets/private/full'
client = GData::Client::DocList.new
email = ARGV[0]
@ma11hew28
ma11hew28 / find-duplicate-files.rb
Last active January 25, 2022 18:48
Ruby script that finds identical (md5) files in all subdirectories (recursive)
# This Ruby script (regardless of where it's located on the file system) recur-
# sively lists all duplicate files in the direcotry in which it's executed.
require 'digest/md5'
hash = {}
Dir.glob('**/*', File::FNM_DOTMATCH).each do |f|
next if File.directory?(f)
key = Digest::MD5.hexdigest(IO.read(f)).to_sym
@ma11hew28
ma11hew28 / matts-flatten.rb
Created September 9, 2010 05:04
Ruby implementation of flatten for nested arrays
#!/usr/bin/env ruby
class Array
def mattflat
if empty? # base case
self
else
tail = pop
if tail.kind_of? Array
mattflat + tail.mattflat
@ma11hew28
ma11hew28 / .vimrc
Last active September 5, 2015 07:34
.vimrc file
" set nocompatible
syntax on
" set ruler " show [line], [column] of cursor in bottom right of window (hurts performance)
" set nu " show line numbers
" set columns=80
" filetype plugin indent on " load custom settings based on file type
" set spell spelllang=en_us
" set softtabstop=2 shiftwidth=2 expandtab
" set splitright
@ma11hew28
ma11hew28 / .gitconfig
Last active April 8, 2020 00:13
Install Git on Mac OS X from Source
[user]
name = Matt Di Pasquale
email = my@fake-email.com
[alias]
ad = add -A
br = branch
cr = clone --recursive
ci = commit -av
cm = commit -am
co = checkout
@ma11hew28
ma11hew28 / .bash_profile
Last active September 4, 2015 20:34
.bash_profile file
# Homebrew, Ruby, Bash Completion
# After upgrading Ruby, run: gem pristine --all --only-executables
export PATH="/usr/local/bin:/usr/local/opt/ruby/bin:$PATH"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Directory Shortcuts
alias prj='cd "$HOME/Projects/"'
@ma11hew28
ma11hew28 / body.rhtml
Created August 29, 2008 02:30
SC custom test view
<%= view :test_view, :view => 'Admin.TestView',
:bind => {:value => 'Admin.masterController.test'} %>
// ==========================================================================
// Admin.TopicFeatureView
// ==========================================================================
require('core');
require('views/collection/collection');
require('views/label');
/** @class