Skip to content

Instantly share code, notes, and snippets.

View JamesPaden's full-sized avatar

James Paden JamesPaden

View GitHub Profile
@JamesPaden
JamesPaden / gist:5170618
Created March 15, 2013 15:21
Sublime Custom Shortcuts
[
//FOCUS GROUP
{ "keys": ["super+ctrl+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["super+ctrl+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["super+ctrl+3"], "command": "focus_group", "args": { "group": 2 } },
{ "keys": ["super+ctrl+4"], "command": "focus_group", "args": { "group": 3 } },
{ "keys": ["super+ctrl+5"], "command": "focus_group", "args": { "group": 4 } },
{ "keys": ["super+ctrl+6"], "command": "focus_group", "args": { "group": 5 } },
{ "keys": ["super+ctrl+7"], "command": "focus_group", "args": { "group": 6 } },
{ "keys": ["super+ctrl+8"], "command": "focus_group", "args": { "group": 7 } },
@JamesPaden
JamesPaden / gist:5447096
Created April 23, 2013 20:26
Sublime Shortcuts
[
//FOCUS GROUP
{ "keys": ["super+ctrl+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["super+ctrl+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["super+ctrl+3"], "command": "focus_group", "args": { "group": 2 } },
{ "keys": ["super+ctrl+4"], "command": "focus_group", "args": { "group": 3 } },
{ "keys": ["super+ctrl+5"], "command": "focus_group", "args": { "group": 4 } },
{ "keys": ["super+ctrl+6"], "command": "focus_group", "args": { "group": 5 } },
{ "keys": ["super+ctrl+7"], "command": "focus_group", "args": { "group": 6 } },
{ "keys": ["super+ctrl+8"], "command": "focus_group", "args": { "group": 7 } },
{
"always_show_minimap_viewport": true,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 10,
"caret_style": "wide",
"color_scheme": "Packages/User/Phoenix Dark Blue Customized.tmTheme",
"create_window_at_startup": false,
"enable_tab_scrolling": false,
"fade_fold_buttons": false,
"font_size": 14,
@JamesPaden
JamesPaden / prince-bootstrap-grid-fix.css
Last active August 16, 2017 12:51
PrinceXML Bootstrap Grid Fix
/*
PrinceXML calculates Bootstrap's ".66666667%" grid width literally, resulting in a
grid that is technically over 100%. Prince then drops the last column to a new row.
These styles override Bootstrap and set the appropriate grid elements to simply
end in "...6%".
*/
.col-xs-11 {
width: 91.66666666%
}
.col-xs-8 {
@JamesPaden
JamesPaden / reverse-proxy.php
Last active November 30, 2021 17:54
Wordpress Reverse Proxy Plugin
<?php
/**
* @package Reverse Proxy
*/
/*
Plugin Name: Reverse Proxy
Plugin URI: https://instrumentalapp.com/
Description: Reverse proxy setup for Instrumental blog
Version: 1.0
Author: James Paden
@JamesPaden
JamesPaden / gist:7a020357e533f4ab31cd
Created September 3, 2015 11:53
Apache Config for Wordpress Reverse Proxy
# Put this inside the <VirtualHost> directive
<Location /blog>
RequestHeader set X-Is-Reverse=Proxy true
RequestHeader set X-Original-Host yourwebsite.com
ProxyPass http://yourpressableblog.com
ProxyPassReverse http://yourpressableblog.com
</Location>
@JamesPaden
JamesPaden / instrumental-notices.js
Last active September 28, 2016 18:07
Example usages of Instrumental Notices in various languages
var I = require('instrumental-node');
I.configure({ apiKey: 'YOUR_PROJECT_TOKEN' });
// WITHOUT DURATION
I.notice('Deployed database query rewrites')
// WITH DURATION
start_time = Date.now()
// Maybe put your deploy code here?
def write_active_migrator_destination_model!
if ActiveMigrator.config.enabled_checker.call(id)
ActiveMigrator.config.metric_incrementer.call("active_migrator.#{active_migrator_source_klass.name}.write_active_migrator_destination_model")
original_record = find_original_model
if original_record
active_migrator_destination_model = original_record.find_active_migrator_destination_model
original_record.transformed_attributes_for_active_migrator.each do |name, value|
active_migrator_destination_model.send(:write_attribute, name, value)
end
active_migrator_destination_model.save!
module ActiveMigrator
class ActiveMigratorDestinationModel < ActiveRecord::Base
self.abstract_class = true
# disable STI for this "copy" model
self.inheritance_column = :_type_disabled
establish_connection DB_ACTIVE_MIGRATOR_CONFIGURATION[:destination]
end
end
module ActiveMigrator
module ActiveMigratorSource
def write_active_migrator_destination_model
begin
write_active_migrator_destination_model!
rescue Exception => e
ActiveMigrator.config.exception_handler.call(e, active_migrator_source_class: active_migrator_source_klass.name, active_migrator_source_id: id)
end
true
end