Skip to content

Instantly share code, notes, and snippets.

Tony Pitale tpitale

Block or report user

Report or block tpitale

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tpitale
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
tpitale / README.md
Last active Jul 10, 2019
Sublime Text plugin to create a simple timestamp
View README.md
  1. Go to Tools > New Plugin
  2. Paste timestamp.py contents and save in User as timestamp.py
  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
View keybase.md

Keybase proof

I hereby claim:

  • I am tpitale on github.
  • I am tpitale (https://keybase.io/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
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 - model.save() triggers errors", {
setup: function() {
Person = DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr()
});
@tpitale
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', 'https://github.com/titoBouzout/SideBarEnhancements', '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
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
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
block.call(
@tpitale
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
end
end
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) }
end
@tpitale
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
end
You can’t perform that action at this time.