Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.axis text {
font: 10px sans-serif;
}
@jamster
jamster / gist:1457369
Created December 11, 2011 00:48
jQuery.autoFitText Plugin Docs

Documentation

Auto Fit Text is a plugin that allows you to programmatically change the font size of text living in an element. Often times when you have a common layout and dynamic content, you may find headers and certain text boxes overflow, or wrap making the design break. With Auto Fit Text, you can have it reduce the font so that it fits perfectly within the original size set for your container element.

Dependencies

  • jQuery 1.6

How To Use By Example

@jamster
jamster / gist:1212216
Created September 12, 2011 19:56
Install Notes for Logstash
version=0.17.6
ES_PACKAGE=elasticsearch-$version.zip
ES_DIR=${ES_PACKAGE%%.zip}
SITE=http://github.com/downloads/elasticsearch/elasticsearch
if [ ! -d "$ES_DIR" ] ; then
wget --no-check-certificate $SITE/$ES_PACKAGE
unzip $ES_PACKAGE
fi
@jamster
jamster / driver.sh
Created September 6, 2011 14:52
A way to pipe in rails logs and split along the double newline
cat sample_rails.log | ruby rails_multiline_log_splitter.rb > output
# ["Started GET \"/\" for 98.113.86.74 at Tue Sep 06 09:44:35 -0400 2011","Processing by LinksController#index as HTML","Completed 401 Unauthorized in 0ms"]
# ["Started GET \"/\" for 98.113.86.74 at Tue Sep 06 09:44:36 -0400 2011","Processing by LinksController#index as HTML","Rendered links/index.html.erb within layouts/main (227.1ms)","Completed 200 OK in 339ms (Views: 228.3ms | ActiveRecord: 21.0ms)"]
# ["Started GET \"/links/11\" for 98.113.86.74 at Tue Sep 06 09:44:52 -0400 2011","Processing by LinksController#show as HTML","Parameters: {\"id\"=>\"11\"}","Rendered links/show.html.erb within layouts/main (190.2ms)","Completed 200 OK in 194ms (Views: 191.1ms | ActiveRecord: 1.2ms)"]
# ["Started GET \"/links/search?utf8=%E2%9C%93&q=ruby+on+rails&commit=Search\" for 98.113.86.74 at Tue Sep 06 09:45:12 -0400 2011","Processing by LinksController#search as HTML","Parameters: {\"commit\"=>\"Search\", \"utf8\"=>\"✓\", \"q\"=>\"ruby on rails\"}"
require 'rubygems'
require 'sinatra'
require 'haml'
class Kaboom < Sinatra::Base
set :show_exceptions, false
set :views, File.dirname(__FILE__) + '/templates'
error do
"{'error' : #{env['sinatra.error'].to_s}}"
@jamster
jamster / mecached_bm.rb
Created August 8, 2011 13:51
Memcached Miss Benchmarker
require 'rubygems'
require 'benchmark'
GC.disable
@mp = MemcachedPage.new
CRZ = 100000
CRZ.times do |x|
@mp.set("/#{x}", "Testing")
end
@jamster
jamster / clean_json.rb
Created May 6, 2011 20:39
Cleaning JSON
require 'rubygems'
require 'yajl/json_gem'
require 'pp'
json_string = DATA.read
pp JSON.parse(json_string)
__END__
{"contact": {
"kABPersonEmailProperty": [{"email": "John-Appleseed@mac.com","label": "Blah","label_local": "Blah"},
{"email": "home@home.com","label": "_$!<Home>!$_","label_local": "home"}
require 'rubygems'
require 'base64'
require 'open-uri'
string = "hardware_version=google&app_version=1.0.0&api_key=asdf1234&device_id=1234&os_version=2.0&user_code=988748513"
encoded = Base64.encode64(string).gsub(/\n/,'')
puts encoded
puts Base64.decode64(encoded)
puts Base64.decode64("aGFyZHdhcmVfdmVyc2lvbj1nb29nbGUmYXBwX3ZlcnNpb249MS4wLjAmYXBpX2tleT1hc2RmMTIzNCZkZXZpY2VfaWQ9MTIzNCZvc192ZXJzaW9uPTIuMCZ1c2VyX2NvZGU9OTg4NzQ4NTEz")
require File.dirname(__FILE__) + '/config/environment'
run ActionController::Dispatcher.new
@jamster
jamster / github_hire_scraper_censored_for_sensitivity.rb
Created April 4, 2011 20:21
How many fucking people have gitub hired?
require 'rubygems'
require 'activesupport'
require 'bad_ass_extensions'
require 'nokogiri'
require 'open-uri'
class GitHubber
attr_accessor :header, :name, :date, :date_string, :links, :post
def initialize(hash, post)