Skip to content

Instantly share code, notes, and snippets.

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
tpitale / scrollbar_example.css
Created Dec 17, 2010
Super simple scrollbars for webkit similar to iOS
View scrollbar_example.css
#sidebar ul.customers::-webkit-scrollbar {
width: 5px;
#sidebar ul.customers::-webkit-scrollbar-thumb:vertical {
margin: 5px;
background-color: #999;
-webkit-border-radius: 5px;
tpitale / czmq-test.rb
Created Oct 9, 2013
Celluloid-zmq PubSub messing about.
View czmq-test.rb
#!/usr/bin/env ruby
gem 'celluloid-zmq', '0.15.0'
require 'celluloid'
require 'celluloid/zmq'
class Publisher
include Celluloid::ZMQ
View gist:162954
#! /bin/sh
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
tpitale / feed.xml
Created Mar 29, 2018 Feed
View feed.xml
<?xml version="1.0"?>
<rss xmlns:atom="" version="2.0">
<description>Petrolicious is a leading automotive lifestyle brand providing world class short films and tasteful editorial around the world&#x2019;s finest classic vehicles.</description>
<copyright>&#xA9; Petrolicious / May Moon Media 2018. All Rights reserved.</copyright>
<atom:link href="" rel="self" type="application/rss+xml"/>
tpitale /
Last active Jan 6, 2018
Loop to rsvg-convert all SVG files to Vector PDF
for i in `ls *.svg`
rsvg-convert -f pdf -o PDF/${i}.pdf $i
tpitale / deeply_hash.rb
Created Aug 25, 2014
Using default proc to deeply, arbitrarily nest new Hash
View deeply_hash.rb
h = {|hash, key| hash[key] =}
h[:foo][:bar][:baz][:bat] = "hello"
p h
#=> {:foo=>{:bar=>{:baz=>{:bat=>"hello"}}}}
View application.es6
import Ember from 'ember';
import Utils from 'docket/utils';
import Status from 'docket/models/status';
import User from 'docket/models/user';
export default Ember.Route.extend({
activate: function() {
// do some setup related to event_source here
tpitale / adjust-srt.rb
Created Apr 19, 2017
Adjust timestamps in an SRT file
View adjust-srt.rb
adjust_by = 48 # seconds
srt ="~/Downloads/"))
new_srt = srt.
map {|s| s.split("\r\n")}.
map do |i, times, *values|
new_times = times.split(" --> ").map {|t| (Time.strptime(t, "%H:%M:%S,%L") + adjust_by).strftime("%H:%M:%S,%L")}.join(" --> ")
tpitale / reel_ws_pg_example.rb
Last active Mar 23, 2017
Reel Websocket Server using PG Listen/Notify for crude pubsub
View reel_ws_pg_example.rb
require 'rubygems'
require 'bundler/setup'
require 'reel'
require 'celluloid/io'
require 'pg'
module PGNotifications
def self.included(actor)
actor.send(:include, Celluloid::IO)