Blog post here
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 'formula' | |
class Sphinx < Formula | |
url 'http://sphinxsearch.com/files/archive/sphinx-0.9.9.tar.gz' | |
homepage 'http://www.sphinxsearch.com' | |
md5 '7b9b618cb9b378f949bb1b91ddcc4f54' | |
depends_on 'mysql' | |
def 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
require 'action_mailer' | |
require 'mail' | |
module ActionMailer | |
class Base | |
def clean_address(str) | |
EmailAddress.parse(str, :no_default_name => true).quoted rescue str | |
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
# This input set: | |
class Idea | |
class Create | |
include Command | |
required do | |
string :title, length: 100 | |
string :body | |
model :user, builder: User::CreateViaEmail, pk: true |
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
# This implmements a custom parse strategy of XML. It's exactly the same as Rails (Hash.from_xml) | |
# except that it rescues syntax errors instead of exploding. | |
ActionController::Base.param_parsers[Mime::XML] = Proc.new do |body| | |
if body.blank? | |
{}.with_indifferent_access | |
else | |
begin | |
Hash.from_xml(body).with_indifferent_access | |
rescue Nokogiri::XML::SyntaxError => e | |
Mouth.increment("corner_cases.nokogiri_syntax_error") |
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> | |
<head> | |
<title>Demo Contact Form - Submit a ticket to UV via JSONP</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript" src="https://jquery-jsonp.googlecode.com/files/jquery.jsonp-2.2.0.min.js"></script> | |
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" /> | |
<style type="text/css"> #contact_form { margin: 20px auto; width: 500px; } </style> | |
</head> | |
<body> |
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
void gemm_full_block(double* restrict A, // rdi | |
double* restrict B, // rsi | |
double* restrict C, // rdx | |
const uint32_t inner_k, // ecx | |
const uint32_t AB_stride, // r8 | |
const uint32_t C_stride, // r9 | |
uint32_t i, | |
uint32_t j, | |
uint32_t k) { |
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
# app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
# ... | |
before_filter :update_dyno | |
def dyno | |
@@dyno_set ||= DynoSet.new | |
end | |