Skip to content

Instantly share code, notes, and snippets.

View tmilewski's full-sized avatar
👋

Tom Milewski tmilewski

👋
View GitHub Profile
@tmilewski
tmilewski / gist:3933235
Created October 22, 2012 18:30 — forked from wesgarrison/gist:3921560
October 19 2012 - rubygems.org - notes on server

[transcript from http://www.youtube.com/watch?v=z73uiWKdJhw and irc]

Why is the server unhappy?

  • Bundle API is 70%-80% of traffic and it has to resolve the dependency graph and Marshal
  • x Processes are spinning in Ruby with 380% (of 400% total CPU [4 x 100%])
  • x Bundle can only use vanilla gems, so that's why we have to use Marshal
  • Redis Heapsize
  • Diskspace

Timing - middle of the day US

@tmilewski
tmilewski / README.txt
Created September 10, 2012 18:25
Accessing Twitter Accounts in iOS5+ via RubyMotion
GOTCHAS:
Adding a Twitter account via the iOS5 simulator does not seem to work. Therefore, you'll need to upgrade to the iOS 6.0 Beta.
cd /Library/RubyMotion/data/6.0
rake update --trace
sudo xcode-select -switch /Applications/Xcode45-DP4.app/Contents/Developer/
PLEASE NOTE:
@tmilewski
tmilewski / gist:2694412
Created May 14, 2012 14:51 — forked from yuki24/gist:1187574
testing facebook connect with capybara and rspec
require 'mogli'
module FacebookIntegrationHelpers
shared_context "with unconnected facebook user" do
let(:fb_user) { create_test_user(installed: false) }
after { fb_user.destroy }
end
def app_client
Mogli::AppClient.new(AppConfig.facebook.access_token, AppConfig.facebook.app_id)
@tmilewski
tmilewski / facebook_registration.rb
Created May 7, 2012 22:23 — forked from nicalpi/facebook_registration.rb
Testing Omniauth with Devise, Rspec and Capybara
background do
set_omniauth()
click_link_or_button 'Sign up with Facebook'
end
@tmilewski
tmilewski / app.rb
Created March 26, 2012 17:37 — forked from cpatni/app.rb
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
(($) ->
$.fn.placeholder = ->
# Check for Placeholder Support
$.support.placeholder = (->
"placeholder" of document.createElement("input")
)()
# Emulate Form Placeholders
unless $.support.placeholder
active = document.activeElement
@tmilewski
tmilewski / jquery.textcounter.js.coffee
Created January 16, 2012 19:43
Manages character counts for a textarea
# Usage
$("textarea").counter
elements:
counter: '.note-area p.counter'
# Manages Character Counts
jQuery.fn.counter = (opts) ->
defaults =
elements:
counter: '.counter'
<html>
<head>
<title>Example</title>
</head>
<body>
<div id="fb-root"></div>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=140499949374170&amp;href=http%3A%2F%2Fexample.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
<fb:comments href="example.com" num_posts="2" width="500"></fb:comments>
</body>
@tmilewski
tmilewski / jquery.filterBy.custom.js
Created April 13, 2011 22:46
Filters a select field based a selection from another.
$(document).ready(function() {
$('.search select#search_tour_stop').filterBy('.search select#search_year');
}
jQuery.fn.filterBy = function(watch) {
options = new Array;
target = $(this);
target.find('option').each(function(index, option) {
@tmilewski
tmilewski / jquery.getScript.js
Created March 31, 2011 15:23
Replace the normal jQuery getScript function with one that supports debugging and which references the script files as external resources rather than inline. Helps with debugging in IE.
// Helps with IE debugging.
jQuery.extend({
getScript: function(url, callback) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
var done = false; // Handle Script loading
script.src = url;
script.onload = script.onreadystatechange = function() { // Attach handlers for all browsers
if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) {