Skip to content

Instantly share code, notes, and snippets.

View jschoolcraft's full-sized avatar

Jeff Schoolcraft jschoolcraft

View GitHub Profile
@jschoolcraft
jschoolcraft / phonegap.css
Created January 9, 2012 21:36 — forked from danro/phonegap.css
CSS Useful PhoneGap Properties
* {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
margin: 0;
padding: 0;
border: 0;
}
@jschoolcraft
jschoolcraft / ObsidianCode.dvtcolortheme
Created December 4, 2011 15:37 — forked from subdigital/ObsidianCode.dvtcolortheme
Obsidian Code Theme for Xcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
@jschoolcraft
jschoolcraft / TechDecisions.md
Created December 1, 2011 18:51
Choices to make in a new Rails project. Would love to see this forked with other's opinions.

Team Support

Source Code Control

git (private server)
Alternative: github

Time Tracking

Cashboard

@jschoolcraft
jschoolcraft / plugins.watchr.rb
Created October 19, 2011 14:02
plugin development sucks less: restart passenger when a file under vendor/plugins changes
# Run me with:
#
# $ watchr plugins.watchr.rb
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def run(cmd)
puts(cmd)
system(cmd)
@jschoolcraft
jschoolcraft / delayed_job.monitrc
Created September 10, 2011 14:37 — forked from denmarkin/delayed_job.monitrc
real-world monit recipes
# See: http://stackoverflow.com/questions/1226302/how-to-monitor-delayedjob-with-monit/1285611
check process delayed_job with pidfile /full/path/to/app/shared/pids/delayed_job.pid
start program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job start'"
stop program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job stop'"
@jschoolcraft
jschoolcraft / mysql2_connection_pool.rb
Created August 25, 2011 18:13
a simple connection pool for eventmachine & mysql2
require 'mysql2'
require 'mysql2/em'
class MysqlConnectionPool
def initialize(conf)
@pool_size = conf[:size] || 10
@connections = []
@query_queue = EM::Queue.new
start_queue conf
@jschoolcraft
jschoolcraft / gist:1168190
Created August 24, 2011 14:29
Capistrano recipe for multi-stage deployment running Passenger standalone
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
# REPLACE this below with your ruby version/gemset version: YOUR_RUBY_VERSION@YOUR_GEM_SET
set :rvm_ruby_string, 'ruby-1.9.2-p136@example_gemset'
set :use_sudo, false
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
>> dates
=> [#<Date: 2011-07-01 (4911487/2,0,2299161)>, #<Date: 2011-07-20 (4911525/2,0,2299161)>]
>> Date.today - dates.map { |d| Date.today - d }.map(&:to_f).inject { |sum, diff| sum + diff } / dates.length
=> #<Date: 2011-07-10 (2455753.0,0,2299161)>
>>
@jschoolcraft
jschoolcraft / gist:1094715
Created July 20, 2011 10:13 — forked from masaki/gist:329030
OO-ish ab (apache bench)
#!/usr/bin/ruby
require 'stringio'
module AB
class Response
class << self
def parse_string(string)
new.tap {|res| res.parse_string(string) }
end
@jschoolcraft
jschoolcraft / reminder.rb
Created June 24, 2011 20:28
rake task to send reminders
# redMine - project management software
# Copyright (C) 2008 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of