<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='100' height='50' %3E%3Ctext font-size='16' x='10' y='20'%3E%3Ctspan fill='red'%3EHello%3C/tspan%3E, %3Ctspan fill='green'%3Eworld%3C/tspan%3E! %3C/text%3E%3C/svg%3E"/>
This file contains 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
<!-- code to show my post --> | |
<% form_for [@post, Comment.new] do |f| %> | |
Body: <%= f.text_field :body %> | |
<p><%= f.submit "Add Comment" %></p> | |
<% end %> |
This file contains 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
require 'benchmark' | |
def benchmark(setting, &block) | |
data = (1..10_000_000).map { block.call } | |
Benchmark.bm(15) do |x| | |
x.report("compact #{setting}") do | |
data.dup.each do |d| | |
[d[0],d[1]].compact.min | |
end |
This file contains 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
# Option 1: | |
# Use content to separate the helper from the spec | |
it "should have something" do | |
content = helper.some_helper_method | |
content.should have_tag('a', :text => 'foo') | |
end | |
# Option 2: | |
# Combine helper call and spec |
This file contains 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
# Required: | |
access_key_id: | |
secret_access_key: | |
bucket_name: | |
# Optional: | |
server: s3.amazonaws.com | |
port: 80 | |
use_ssl: false | |
persistent: false |
This file contains 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
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz | |
tar -xvzf ruby-1.9.3-p286.tar.gz | |
cd ruby-1.9.3-p286/ | |
./configure --prefix=/usr/local | |
make | |
make install |
This file contains 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> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script> | |
<style type="text/css"> | |
body { | |
background: #000; | |
} |
This file contains 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
#!/bin/sh | |
# | |
# init.d script for single or multiple unicorn installations. Expects at least one .conf | |
# file in /etc/unicorn | |
# | |
# Modified by [email protected] http://github.com/jaygooby | |
# based on http://gist.github.com/308216 by http://github.com/mguterl | |
# | |
## A sample /etc/unicorn/my_app.conf | |
## |
This file contains 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
#!/usr/bin/env python3 | |
# CodeIgniter pre-2.2 non-mcrypt Encrypt reverser. | |
# Finds the key by partially-known plaintext attack. | |
# Written by Yuki Izumi. Placed in the public domain. | |
import codecs | |
import re | |
import sys | |
import time |