Skip to content

Instantly share code, notes, and snippets.

View jcamenisch's full-sized avatar

Jonathan Camenisch jcamenisch

  • Raleigh, NC
  • 06:29 (UTC -04:00)
View GitHub Profile
@jcamenisch
jcamenisch / .profile fragment
Created January 24, 2012 19:19
Lightning-fast project-wide find/replace with git grep and sed
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@jcamenisch
jcamenisch / .rvmrc
Created June 15, 2011 06:03
Proposed standard .rvmrc to encapsulate desired gemset practice ala http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/
rvm use ruby-1.9.2 #or ruby of choice
if [ -t 0 ]; then # In interactive shell; offer assistance
if [ ! -f .bundle/config ]; then
echo 'For this project, you should set your bundle path to ./vendor'
read -sn 1 -p 'Would you like to configure this now? [yn]' RESPONSE
echo
if [ "$RESPONSE" = "y" -o "$RESPONSE" = "Y" ]; then
[ ! -d .bundle ] && mkdir .bundle
cat > .bundle/config <<EoF
@jcamenisch
jcamenisch / process.rb
Created June 10, 2011 15:44
Solution to Puzzle Node's puzzle #4
class Wall
attr_reader :text
def initialize(text)
@text = text
@lasers = []
@text.each_char do |c|
@lasers << (c == '|' ? 1 : 0)
end
end
@jcamenisch
jcamenisch / sunburst-pattern.css
Created April 27, 2011 02:55
CSS3 Gradient Sunburst Pattern
html {
min-height: 100%;
background:
linear-gradient(81deg,transparent 86.3%,#eee 86.3%,#eee),
linear-gradient(72deg,transparent 75.4%,#ddd 75.4%,#ddd),
linear-gradient(63deg,transparent 66.25%,#eee 66.25%,#eee),
linear-gradient(54deg,transparent 57.85%,#ddd 57.85%,#ddd),
linear-gradient(45deg,transparent 49.9%,#eee 49.9%,#eee),
linear-gradient(36deg,transparent 41.96%,#ddd 41.96%,#ddd),
linear-gradient(27deg,transparent 33.6%,#eee 33.6%,#eee),
@jcamenisch
jcamenisch / sunburst.css
Created April 26, 2011 21:17
CSS3 Sunburst
html {
background:
linear-gradient(90deg, transparent 50%, #ddd 50%, #ddd),
linear-gradient(82deg, transparent 50%, #eee 50%, #eee),
linear-gradient(67deg, transparent 50%, #ddd 50%, #ddd),
linear-gradient(52deg, transparent 50%, #eee 50%, #eee),
linear-gradient(37deg, transparent 50%, #ddd 50%, #ddd),
linear-gradient(22deg, transparent 50%, #eee 50%, #eee),
linear-gradient(7deg, transparent 50%, #ddd 50%, #ddd),
linear-gradient(-8deg, transparent 50%, #eee 50%, #eee),
@jcamenisch
jcamenisch / config.ru
Created March 29, 2011 04:07
serve on heroku
#\ -p 4000
require 'serve'
require 'serve/rack'
require 'json'
# The project root directory
root = ::File.dirname(__FILE__)