Skip to content

Instantly share code, notes, and snippets.

View hiltmon's full-sized avatar

Hilton Lipschitz hiltmon

View GitHub Profile
@hiltmon
hiltmon / development_profiler.rb
Created February 28, 2012 03:55
Simple class to wrap a profile run around some code
class DevelopmentProfiler
def self.prof(file_name)
RubyProf.start
yield
results = RubyProf.stop
# Print a flat profile to text
File.open "#{Rails.root}/tmp/performance/#{file_name}-graph.html", 'w' do |file|
@hiltmon
hiltmon / cfile.rb
Created July 16, 2012 16:47
Quick and dirty script to list all the different kinds of files in a project folder
#! /usr/bin/ruby
# cfile.rb
# Hilton Lipschitz
# Use and modify freely, attribution appreciated
#
# This script counts the number and kinds of files in a project. Any additional
# parameters are treated as exclude folder regexes
#
# Requirements:
@hiltmon
hiltmon / post.rb
Created July 18, 2012 22:18
Create a new Octopress post, isolate it, generate the site and leave a preview thread running
#! /usr/bin/ruby
# post.rb
# Hilton Lipschitz (http://www.hiltmon.com) @hiltmon
# Use and modify freely, attribution appreciated
#
# Create a new Octopress post, isolate it, generate the
# site and leave me with a preview thread running.
#
# MUST BE RUN in the Octopress root folder
@hiltmon
hiltmon / googleanalyticslogger.rb
Created November 14, 2012 13:29
Google Analytics Logger
=begin
Plugin: GoogleAnalyticsLogger
Description: Daily Web Site Stats Logger
Author: [Hilton Lipschitz](http://www.hiltmon.com)
Configuration:
client_id: 'XXXXXXXXXXXXXX.apps.googleusercontent.com'
client_secret: 'XXXXXXXXXXXXXXXX'
auth_code: '4/XXXXXXXXXXXXXXXXXXXXXXXXXXX'
properties: [ 'UA-XXXXXXXX-1', 'UA-XXXXXXX-2' ]
show_sources: true
@hiltmon
hiltmon / slogger.rb
Created November 14, 2012 13:32
Changes to slogger.rb
# Line 172 : WAS
eval(plugin['class']).new.do_log
# CHANGE TO
if plugin['updates_config'] == true
# Pass a reference to config for mutation
eval(plugin['class']).new.do_log(@config)
else
@hiltmon
hiltmon / yahoofinancelogger.rb
Created December 1, 2012 21:30
Yahoo Finance Logger
=begin
Plugin: YahooFinanceLogger
Description: Logs a portfolio of prices from Yahoo finance
Author: [Hilton Lipschitz](http://www.hiltmon.com)
Configuration:
- tickers: an array of valid Yahoo tickers to log
- show_details: If true, adds day and 52 week high and low, volume, P/E and Market Cap
Notes:
- Does not run on weekends as the markets are closed (but does run on holidays)
- Runs in real time, so if run during the day, will get as at the run time values
@hiltmon
hiltmon / CombinedCasts.tmTheme
Last active December 14, 2015 02:59
CombinedCasts.tmTheme - Save as `CombinedCasts.tmTheme` and double-click to install.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Hilton Lipschitz</string>
<key>name</key>
<string>CombinedCasts</string>
<key>semanticClass</key>
<string>theme.combinedcasts</string>
@hiltmon
hiltmon / gist
Created February 25, 2013 04:01
#!/usr/bin/env ruby -wKU
# gist
# Hilton Lipschitz (http://www.hiltmon.com)
# Use and modify freely, attribution appreciated
#
# This script allows you to get, list, create, and update Github gists
# from the command line. There are others like this but this one caches
# file names to gist mappings so you do not need to remember them. The
# cache is just a YAML file in ~/.gists. This script also leaves

Test Gist

This is a test.

Updated. Again.

New Gist

For fun...

And profit...

And pleasure...