Skip to content

Instantly share code, notes, and snippets.

View acarabott's full-sized avatar

Arthur Carabott acarabott

View GitHub Profile
@acarabott
acarabott / username.conf
Created January 12, 2014 12:15
OS X apache conf to allow symbolic links in Sites folder /etc/apache2/users/username.conf
<Directory "/Users/username/Sites/">
# Options Indexes MultiViews
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
@acarabott
acarabott / chordNoteShifter.js
Last active January 1, 2016 11:59
Logic Pro X Scripter MIDI FX that that shifts the top or bottom note of a chord up or down by 1 or 2 octaves, with parametric controls.
NeedsTimingInfo = true;
var start = Date.now(),
triggered = false,
prev;
var PluginParameters = [
{
name: "Window Length",
defaultValue: 80,
@acarabott
acarabott / beatShifter.js
Created December 27, 2013 02:12
Logic Pro X Scripter MIDI FX that pitch shifts notes played in beats 1 and 3 of the bar
var shift = 0;
NeedsTimingInfo = true;
function HandleMIDI(event) {
event.pitch += shift;
event.send();
}
function ProcessMIDI () {
@acarabott
acarabott / functions.php
Created December 16, 2013 23:41
Wordpress remove content image dimensions without regexp
function remove_img_dimensions($html) {
$dom = new DOMDocument;
$dom->loadHTML($html);
$imgs = $dom->getElementsByTagName('img');
foreach ($imgs as $img) {
$img->removeAttribute('width');
$img->removeAttribute('height');
}
@acarabott
acarabott / responsive_embed.css
Created October 13, 2013 12:50
Make embed codes responsive
.embed-wrap {
position: relative;
padding-top: 25px; /* IE6 workaround*/
height: 0;
object, embed, iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
@acarabott
acarabott / config.rb
Last active December 19, 2015 13:59
Capistrano SSH agent forwarding for shared hosts where authentication fails when accessing repos (not complete config.rb)
default_run_options[:pty] = true # Must be set for the password prompt from git to work
# Tell Capistrano to use agent forwarding with this command. uses your local keys instead of keys installed on the server.
ssh_options[:forward_agent] = true
ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')
# shared hosts e.g. hostgator prevent filfefs with high (>5) group privileges from being run (rightfully)
set :group_writable, false
# You will probably have to update any submodules that are have an SSH remote to use https e.g.
@acarabott
acarabott / injectMultiple.js
Created June 18, 2013 23:37
Inject multiple scripts on Chrome Extension pageAction
function createSrcCall(tabId, src, callback) {
return function () {
if (callback !== undefined) {
chrome.tabs.executeScript(tabId, {file: src}, callback);
} else {
chrome.tabs.executeScript(tabId, {file: src});
}
};
}
@acarabott
acarabott / gist:4635408
Created January 25, 2013 15:47
Wordpress - Add default menu_order to custom post type, optional terms
<?php
// Add to functions.php
// Make sure your custom post type has 'page-attributes' in its supports array
// Adjust the 'typeN's to your custom post types
// the first type
add_filter( 'wp_insert_post_data', 'set_menu_order', 10, 2 );
function set_menu_order( $data, $postarr ) {
global $post;
$pt = $data['post_type'];
@acarabott
acarabott / gist:4531195
Created January 14, 2013 16:18
Add page-slug to body class of wordpress pages
<?php
// Add to functions.php
// Add page-slug to body
function add_body_class( $classes )
{
global $post;
if ( isset( $post ) ) {
if (substr($post->post_type, 0, 4) == 'page') {
$classes[] = $post->post_type . '-' . $post->post_name;
@acarabott
acarabott / gist:4139266
Created November 24, 2012 11:25
Fixing 'Too many authentication failures' SSH error
This is usually caused by using multiple different ssh keys for a server without turning on IdentitiesOnly.
To get access to your account, get your host to run ssh-add -D to clear the identities. Once you are logged back in, add this to your ~/.ssh/config file:
IdentitiesOnly yes
via: http://superuser.com/questions/187779/too-many-authentication-failures-for-username