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> | |
<title>processing png</title> | |
<script src="http://processingjs.org/content/download/processing-js-1.1.0/processing-1.1.0.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<canvas width="0" height="0"></canvas> (Canvas) |
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 | |
# 0. Requires Mac OS X 10.6 (Snow Leopard) or later | |
# 1. Open Automator.app | |
# 2. Choose "Service" template | |
# 3. Enter "shell" and drag & drop "Run Shell Script" | |
# 4. Check "Replaces selected text" | |
# 5. Ensure that Shell: "/bin/bash" and Pass input: "to stdin" | |
# 6. Paste ***ENTIRE THIS SCRIPT*** to the textarea | |
# 7. Save the service as "goo.gl" or what you like | |
url=$(cat /dev/stdin) |
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
// -*- ObjC -*- | |
// Hiroshi Saito / Yakitara.com | |
/* | |
You know OCMock does great, but (If I'm not get wrong with it) | |
- it will supposed to be used in tests not a production code | |
- it can't mock class methods | |
- it requires an instace to be mocked accessible in your tests | |
If you not familiar with alias_method_chain, see: | |
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/aliasing.rb |
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
#ifndef _AutoRef_h_ | |
#define _AutoRef_h_ | |
/* Example | |
#include "AutoRef.h" | |
void AutoRefRelease(CGImageRef ref) { CGImageRelease(ref); } | |
void someFunction(void) { | |
AutoRef<CGImage> image = CGImageCreateCopy(src); |
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
function FindProxyForURL(url, host) { | |
if (shExpMatch(url, "lifehacker.com/*")){ | |
return "PROXY us.lifehacker.com"; | |
} | |
if (shExpMatch(url, "gizmodo.com/*")){ | |
return "PROXY us.gizmodo.com"; | |
} | |
return "DIRECT"; | |
} |
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
class ApplicationController < ActionController::Base | |
# FORCE to implement content_for in controller | |
# I'm not sure that this works with rails < 3.0.0rc | |
def view_context | |
super.tap do |view| | |
(@_content_for || {}).each do |name,content| | |
view.content_for name, content | |
end | |
end | |
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
# -*- coding: utf-8 -*- | |
# config/initializers/rack_encoding_binary_fix.rb | |
# 2010-07-04: @hiroshi3110, [email protected], http://github.com/hiroshi | |
# I wrote this for Rails 3 beta 4 / Ruby 1.9.2-pre3. | |
# This is a VERY nasty patch for work arounding rack's Encoding::BINARY (ASCII-8BIT) rack.input issue. | |
# I don't know the RIGHT solution about the issue, but I have to fix: | |
# Encoding::UndefinedConversionError ("\xE3" from ASCII-8BIT to UTF-8) | |
# Sometime in the future, I hope this is no use... | |
# References: | |
# wycats pointed at "Where it doesn’t work" in http://yehudakatz.com/2010/05/17/encodings-unabridged/ |
NewerOlder