Skip to content

Instantly share code, notes, and snippets.

@jhuckabee
jhuckabee / gist:810552e99959eacbbea9
Last active August 29, 2015 14:06
rails-ajax.html
<polymer-element name="rails-ajax" extends="core-ajax">
<script>
Polymer({
ready: function() {
this.super();
this.csrfParam = document.querySelector("meta[name=csrf-param]").content;
this.csrfToken = document.querySelector("meta[name=csrf-token]").content;
},
getParams: function(params) {
@jhuckabee
jhuckabee / gist:0f89371b2a55ec0ba98c
Last active August 29, 2015 14:07
Yosemite Upgrade Notes

For those of you using Homebrew and Homebrew installed PostgreSQL, here's a few notes on my Yosemite upgrade from over the weekend:

Slow Installer

The installation process went smoothly right up until the end. With "3 minutes remaining" it appeared to stall. Be patient. In the background the installer is doing some weird copying routine of /usr/local. This took 4 hours on my machine. Hit Cmd-L to see the log of what's going on.

PostgreSQL

During the above mentioned copying routine of /usr/local, it seems to be skipping empty directories. Unfortunately PostgreSQL requires a few of these empty directories to be present to run properly. To fix this simply run:

= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"
= javascript_include_tag 'rails'
<a href="/users/1" onclick="if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); };return false;">Delete</a>
%meta{:name => 'csrf-token', :content => form_authenticity_token}
%meta{:name => 'csrf-param', :content => 'authenticity_token'}
<meta name="csrf-token" content="<%= form_authenticity_token %>" />
<meta name="csrf-param" content="authenticity_token" />
<a rel="nofollow" data-method="delete" data-confirm="Are you sure?" class="delete" href="/user/1">Delete</a>
<div id="event_type" ex:role="facet" ex:expression=".tid" ex:facetLabel="Event Type" ex:collapsible="true"></div>
<div id="event_tags" ex:role="facet" ex:expression=".tid_1" ex:facetLabel="Tags" ex:collapsible="true"></div>
<h2><%= users.length %> Users</h2>
<ul>
<% for(var i=0; i < users.length; i++) { %>
<li><a href="<%=users[i].url%>"><%=users[i].name%></a></li>
<% } %>
</ul>
@jhuckabee
jhuckabee / tmux_iterm2.rb
Created March 14, 2012 17:40
Brew script for 'Tmux for iTerm2'
require 'formula'
class TmuxIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20120203.tar.gz'
md5 '59305a26bdd0245054fe719e6b2a960e'
homepage 'http://code.google.com/p/iterm2/downloads/detail?name=tmux-for-iTerm2-20120203.tar.gz&can=2&q='
depends_on 'libevent'
def install