This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
## Description | |
A tool for Octopress to generate IDs in header tags and index list aside. It helps you easily build a tutorial page with many chapters. | |
## Features | |
* Support all languages. | |
## Syntax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rake deploy:production master | |
# List of environments and their heroku git remotes | |
ENVIRONMENTS = { | |
:staging => 'myapp-staging', | |
:production => 'myapp-production' | |
} | |
namespace :deploy do | |
ENVIRONMENTS.keys.each do |env| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function cleans up messy HTML that was pasted by a user to a WYSIWYG editor. | |
# Specifically it also handles messy Word\Outlook generated HTML while keeping its original formattings. | |
require 'rubygems' | |
require 'sanitize' | |
def clean_up_document(html) | |
elements = %w[p b h1 h2 h3 h4 h5 h6 strong li ul ol i br div pre p] | |
attributes = { | |
'a' => ['href', 'title'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI_JAR = File.dirname(__FILE__) + "/../tools/yuicompressor-2.4.2.jar" | |
class YuiCompressor < Nanoc3::Filter | |
identifier :yui_compress | |
type :text => :binary | |
def run(content, params={}) | |
type = type_from_extension | |
cmd = "java -jar #{YUI_JAR} --type #{type} -o #{output_filename}" | |
IO.popen(cmd, 'w') { |f| f.write(content) } | |
raise "yuicompressor exited with #{$?} for '#{cmd}'" unless $? == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias fuckit="git add . && git commit -m 'Throwaway commit' && git reset --hard HEAD^" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<!-- saved from url=(0068)http://24ways.org/examples/compose-to-a-vertical-rhythm/example.html --> | |
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<TITLE>Compose a Vertical Rhythm example</TITLE> | |
<LINK rel="alternate stylesheet" type="text/css" href="vertical_rhythm.css" title="sass"> | |
<LINK rel="alternate stylesheet" type="text/css" href="original.css" title="original"> | |
</HEAD><BODY> | |
<H1>Aboard Minerva off the Coast of New England</H1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SunSpider Results | |
Safari (Version 4.0.4 (6531.21.10)): | |
http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?%7B%223d-cube%22:%5B15,16,15,16,15%5D,%223d-morph%22:%5B21,20,21,21,20%5D,%223d-raytrace%22:%5B18,18,17,17,18%5D,%22access-binary-trees%22:%5B10,8,9,8,8%5D,%22access-fannkuch%22:%5B16,17,18,16,16%5D,%22access-nbody%22:%5B11,11,11,11,11%5D,%22access-nsieve%22:%5B10,9,9,9,9%5D,%22bitops-3bit-bits-in-byte%22:%5B3,3,3,3,3%5D,%22bitops-bits-in-byte%22:%5B7,8,7,8,7%5D,%22bitops-bitwise-and%22:%5B4,5,5,5,4%5D,%22bitops-nsieve-bits%22:%5B7,7,8,8,7%5D,%22controlflow-recursive%22:%5B4,4,4,3,4%5D,%22crypto-aes%22:%5B14,13,13,12,13%5D,%22crypto-md5%22:%5B7,8,7,8,7%5D,%22crypto-sha1%22:%5B6,6,5,6,4%5D,%22date-format-tofte%22:%5B34,34,36,35,35%5D,%22date-format-xparb%22:%5B41,39,39,39,40%5D,%22math-cordic%22:%5B10,10,11,11,11%5D,%22math-partial-sums%22:%5B18,18,18,18,18%5D,%22math-spectral-norm%22:%5B8,8,8,8,7%5D,%22regexp-dna%22:%5B29,28,28,28,28%5D,%22string-base64%22:%5B25,29,26,29,26%5D,%22string-fas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system "gem sources -a http://gems.github.com" | |
required_gems = %w{ pauldix-feedzirra prawn } | |
required_gems.each { |required_gem| system "sudo gem install #{required_gem} --no-ri --no-rdoc" } | |
require 'rubygems' | |
require 'feedzirra' | |
require 'prawn' | |
require 'net/ftp' | |
ftp_address = 'snuggietonight.com' |
NewerOlder