Skip to content

Instantly share code, notes, and snippets.

View jcamenisch's full-sized avatar

Jonathan Camenisch jcamenisch

  • Raleigh, NC
  • 01:24 (UTC -04:00)
View GitHub Profile
@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__)
@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 / 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 / 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 / .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 / .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 / cicada-noise.css
Created June 8, 2012 00:09
Add noise to a background using modest-sized tile, but preventing any noticeable repetition
html {
background-color: #eed;
background-image: url(noise.png), url(noise.png), url(noise.png);
background-size: 79px 79px, 101px 101px, 73px 73px;
background-position: 0 0, 5px 5px, 11px 11px;
}
@jcamenisch
jcamenisch / glyph-end-sign.css
Created June 23, 2012 20:16
Pure CSS End Sign with ::after and a glyph character
.with-end-mark > p:last-child::after {
display: inline;
content: " \0020\2118";
color: #644609;
}
@jcamenisch
jcamenisch / image-end-sign.css
Created June 23, 2012 20:25
Pure CSS End Sign with ::after and an image
.with-end-mark-2 > p:last-child::after {
display: inline;
content: "\0020" url(/attachments/celtic-knot.png);
color: #644609;
}
@jcamenisch
jcamenisch / gmailsnooze.js
Created September 28, 2012 17:23
Gmail Snooze
var
MARK_UNREAD = true,
UNSNOOZED_LABEL = null,
LABEL_NAME_TEMPLATE = "Snooze/{{days}} days",
DEBUG_LEVEL = 0
;
var LABEL_REGEX = RegExp(LABEL_NAME_TEMPLATE.replace('{{days}}','(\\d+)'));
function debugLog(message, minDebugLevel) {