Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
@iloveitaly
iloveitaly / snippets.bash
Created February 20, 2014 14:42
Snippets for WordPress Development & Deployment
# dreamhost server setup
curl https://gist.github.com/iloveitaly/6979578/raw/.bash_profile > ~/.bash_profile
curl https://gist.github.com/iloveitaly/6979578/raw/.gitconfig > ~/.gitconfig
curl https://gist.github.com/iloveitaly/6979578/raw/.phprc >> $HOME/.php/5.4/phprc
# add ssh key to remote server for easy login
cat ~/.ssh/id_rsa.pub | ssh login@server.com 'mkdir ~/.ssh; touch ~/.ssh/authorized_keys; cat >> ~/.ssh/authorized_keys'
# switch essential wordpress settings when dumping from production DB to dev DB
wp option set siteurl http://joy.dev/
# app/middleware/disable_assets_logger.rb
# https://github.com/rails/rails/issues/2639#issuecomment-6591735
# http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
class DisableAssetsLogger
def initialize(app)
@app = app
Rails.application.assets.logger = Logger.new('/dev/null')
end
@iloveitaly
iloveitaly / setup_ichat_trigger.applescript
Created April 8, 2014 15:06
Setup a AppleScript trigger in Messages when a share my screen request is received via AppleScript
tell application "Messages" to activate
delay 3
tell application "System Events"
tell process "iChat"
keystroke "," using command down
click button "Alerts" of tool bar 1 of window 1
@iloveitaly
iloveitaly / select_itunes_dj.applescript
Last active August 29, 2015 13:58
Select iTunes DJ Playlist. For older versions (pre iTunes 11). Useful Applescript UI scripting debugging
on select_dj_playlist(playlist_name)
try
with timeout of 10 seconds
tell application "Finder"
set os_version to version
end tell
set errorString to ""
tell application "System Events"
@iloveitaly
iloveitaly / tax_rate_decorator.rb
Created April 30, 2014 21:08
Disable tax calculation on an order in Spree Commerce
Spree::TaxRate.class_eval do
# UPGRADE_CHECK https://github.com/spree/spree/blob/1-3-stable/core/app/models/spree/tax_rate.rb#L33
def self.adjust(order)
order.clear_adjustments!
# TODO you'll have to customize this based on your situation
if order.taxable_flag?
return
end
@iloveitaly
iloveitaly / itunes_eleven_utilities.applescript
Created May 18, 2014 14:33
Some utilities for managing iTunes preferences that are not accessible via AppleScript
on ensure_playlist_sort_and_list_view()
-- http://stackoverflow.com/questions/4056812/how-to-change-the-order-of-a-song-within-an-itunes-playlist-by-applescript/13667549#13667549
tell application "System Events"
tell process "iTunes"
-- ensure list view
try
outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window "iTunes"
on error
-- then we are not in list view
click menu button "View" of splitter group 1 of window "iTunes"
<?php
require( dirname( __FILE__ ) . '/wp/wp-load.php' );
$posts = new WP_Query('post_type=post&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;
header('Content-type:text/plain');
foreach($posts as $post) {
$permalink = get_permalink($post->ID);
@iloveitaly
iloveitaly / feed2.php
Created January 16, 2010 18:38
Kohana 2 feed class with better namespace support
<?
class Feed2 extends feed {
/**
* Creates a feed from the given parameters.
*
* @param array feed information
* @param array items to add to the feed
* @param string define which format to use
* @param string define which encoding to use
* @return string
@iloveitaly
iloveitaly / flash-screenshot.applescript
Created May 12, 2010 21:06
Take a screenshot of a SWF
-- Author: Michael Bianco
-- References:
-- http://discussions.info.apple.com/thread.jspa?messageID=11447012
-- http://macscripter.net/viewtopic.php?id=28958
on run argv
generate_window_screenshot(item 1 of argv)
end run
<?php
/* PHP Paypal IPN Integration Class Demonstration File
* 6.25.2008 - Eric Wang, http://code.google.com/p/paypal-ipn-class-php/
*
* This file demonstrates the usage of paypal.class.php, a class designed
* to aid in the interfacing between your website, paypal, and the instant
* payment notification (IPN) interface. This single file serves as 4
* virtual pages depending on the "action" varialble passed in the URL. It's
* the processing page which processes form data being submitted to paypal, it