Skip to content

Instantly share code, notes, and snippets.

require 'rack/utils'
require 'nokogiri'
class HtmlDemo
include Rack::Utils
def initialize(app, opts = {})
@app = app
@opts = {
:element_id => 'page',
$('.ajax_save').click (e) ->
e.preventDefault()
$('form').submit() #data-remote is set to true on the form on page load
$('form').attr('action', $('form').data('update-url'))
$('.postback_save').click (e) ->
e.preventDefault()
$('form').removeAttr('data-remote') #on the form on page load
$("form").removeData("remote") #because it's cached
$('form').submit()
$(document).ready(function() {
var attorneys_html, hideRoles, investors_html, page, path, revealRoles, small_business_html, url;
$('.role_choices').hide();
revealRoles = function(element) {
$('.role_choices').slideDown('fast');
$(element).addClass('button_text_and_arrow_open');
$(element).removeClass('button_text_and_arrow_closed');
return $('.down_arrow').css('background-position', '0px -23px');
};
$(document).ready ->
$('.role_choices').hide()
revealRoles = (element) ->
$('.role_choices').slideDown 'fast'
$(element).addClass 'button_text_and_arrow_open'
$(element).removeClass 'button_text_and_arrow_closed'
$('.down_arrow').css('background-position', '0px -23px')
hideRoles = (element) ->
@jondkinney
jondkinney / launch_app.applescript
Last active December 13, 2015 18:58
Launch an app if it's not already launched (and make sure it's focused after launch). Otherwise show/hide it if it's already launched. Could probably be improved...
set appName to "Sparrow"
set startIt to false
tell application "System Events"
if not (exists process appName) then
set startIt to true
else
if frontmost of process appName then
set visible of process appName to false
else
@jondkinney
jondkinney / private.xml
Created February 14, 2013 18:46
private.xml file for KeyRemap4MacBook which provides several custom key maps when using iTerm only. Great for console Vim.
<?xml version="1.0"?>
<root>
<item>
<name>Fn keys for iterm</name>
<identifier>private.fn_keys_for_iterm</identifier>
<only>TERMINAL</only>
<autogen>--ConsumerToKey-- ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8 </autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::MUSIC_PREV, KeyCode::F7 </autogen>
@jondkinney
jondkinney / disable_notificaiton_center.applescript
Last active December 12, 2015 12:28
You can add each of these scripts to Pomodoro.app's start/end AppleScript actions and disable / enable notification center as well as quit / launch some apps.
tell application "System Events"
tell process "Notification Center"
key down option
click menu bar item 1 of menu bar 1
key up option
end tell
end tell
--quit some apps that I tend to check too often when I should be focusing on coding.
try
-#Intercom Configuration
- if defined? IntercomRails
- if logged_in?
- if current_user.entrepreneur? && current_user.company.present? && current_user.company.current_campaign
- camp_name = current_user.company.current_campaign.name rescue 'None'
- camp_status = current_user.company.current_campaign.status rescue 'None'
- else
- camp_name = 'N/A'
- camp_status = 'N/A'
:erb
@jondkinney
jondkinney / gist:4342948
Created December 20, 2012 04:19
Toggle bluetooth via AppleScript, which I use with Keyboard Maestro to toggle bluetooth via a hotkey combo
-- This assumes you have both growlnotify and blueutil installed.
-- You can set the path to either/both apps in the script on line 12 and 13
-- blueutil is a command line utility to turn bluetooth on and off and is available here:
-- http://www.frederikseiffert.de/blueutil/
-- growlnotify is a command line utility to post Growl notifications and is available when
-- installing Growl 1.2.2 which is available here:
-- http://growl.googlecode.com/files/Growl-1.2.2.dmg
@jondkinney
jondkinney / private.xml
Created October 11, 2012 18:49
Key Remap for private.xml
<?xml version="1.0"?>
<root>
<item>
<name>Fn keys for iterm</name>
<identifier>private.fn_keys_for_iterm</identifier>
<only>TERMINAL</only>
<autogen>--ConsumerToKey-- ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8 </autogen>
<autogen>--ConsumerToKey-- ConsumerKeyCode::KEYBOARDLIGHT_HIGH, KeyCode::F6 </autogen>