Skip to content

Instantly share code, notes, and snippets.

tpitale / convert_sf_id.js
Last active Aug 29, 2015
Javascript from salesforce id converter to add suffix characters.
View convert_sf_id.js
function convertId(id) {
if (id == null) return id;
id = id.replace(/\"/g, '');
if (id.length != 15) {
return null;
var suffix = "";
for (var i = 0; i < 3; i++) {
var flags = 0;
for (var j = 0; j < 5; j++) {
tpitale /
Last active Jan 4, 2021
Sublime Text plugin to create a simple timestamp
  1. Go to Tools > New Plugin
  2. Paste contents and save in User as
  3. Open Preferences > Key Bindings - User (or Default, your call)
  4. Paste keybindings.json, or add a line to your keybindings
  5. Customize the keyboard shortcut to your liking and save

Keybase proof

I hereby claim:

  • I am tpitale on github.
  • I am tpitale ( on keybase.
  • I have a public key whose fingerprint is 6C17 F481 4889 B9AD 61EC 7719 A2EA 6E3E FD48 2FE3

To claim this, I am signing this object:

tpitale / errors_test.js
Created Jul 6, 2014
Failing test for conflict between Errors.content and a model attribute named content
View errors_test.js
// Added to the bottom of tests/unit/model/errors_test.js
var env, store, Person, Dog;
module("unit/model/errors - triggers errors", {
setup: function() {
Person = DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr()
tpitale / gist:93428db182dd44ec52e5
Created Jun 11, 2014
SideBarEnhancement for ST2
View gist:93428db182dd44ec52e5
import os; path=sublime.packages_path(); (os.makedirs(path) if not os.path.exists(path) else None); window.run_command('exec', {'cmd': ['git', 'clone', '', 'SideBarEnhancements'], 'working_dir': path})
import os; path=sublime.packages_path(); window.run_command('exec', {'cmd': ['git', 'checkout', '37429739a0452a2dc36343fb7875ba7fcbeb88a9'], 'working_dir': os.path.join(path, 'SideBarEnhancements')})
tpitale / data.tsv
Created May 29, 2014
Minimally responsive (flexible width) D3 Bar Chart
View data.tsv
letter frequency
A .08167
B .01492
C .02782
D .04253
E .12702
F .02288
G .02015
H .06094
I .06966
tpitale / wait_for_notify.rb
Last active Aug 29, 2015
Implementation of wait_for_notify with PG and Celluloid::IO
View wait_for_notify.rb
def wait_for_notify(&block)
io = pg_connection.socket_io
while @listening do
Celluloid::IO.wait_readable(io) # blocks execution, but unblocks this actor
pg_connection.consume_input # fetch any input on this connection
# read the NOTIFY messages off the socket
while notification = pg_connection.notifies do
tpitale / spec_helper.rb
Created May 24, 2014
Disable "should" syntax
View spec_helper.rb
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
View empty-rows-missing.rb
# connection and profile selection skipped
class Pageview
extend Legato::Model
metrics :pageviews
dimensions :pagePath, :date
filter :for_path, &lambda { |path| contains(:pagePath, path) }
tpitale / too_clever.rb
Created Mar 29, 2014
Chained enumerable and block arg destructuring
View too_clever.rb
[1,2,3,4,5].each_cons(2).each_with_index do |(a, b), i|
p a
p b
p i
You can’t perform that action at this time.