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 'uri' | |
uri = Hash.new do |hash, key| | |
puts 'evaluated' | |
hash[key] = URI.parse(key) rescue nil | |
end | |
host = uri['http://google.com'].host | |
#=> evaluated | |
puts host | |
#=> google.com |
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
kill -USR2 `cat /tmp/unicorn.pid` |
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/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-mysql | |
# vi /etc/td-agent/td-agent.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
cd /usr/local/src | |
# luaのinstall | |
wget -O lua-nginx-module.tar.gz https://github.com/chaoslawful/lua-nginx-module/tarball/master | |
tar zxvf lua-nginx-module.tar.gz | |
# luajitのinstall | |
wget http://luajit.org/download/LuaJIT-2.0.0.tar.gz | |
tar zxvf LuaJIT-2.0.0.tar.gz | |
cd LuaJIT-2.0.0 |
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
var data = [ | |
{first_name: 'aa', family_name: 'xx', old:12}, | |
{first_name: 'bb', family_name: 'xx', old:13}, | |
{first_name: 'cc', family_name: 'xx', old:14}, | |
{first_name: 'aa', family_name: 'yy', old:15}, | |
{first_name: 'bb', family_name: 'yy', old:16}, | |
{first_name: 'cc', family_name: 'yy', old:17}, | |
{first_name: 'aa', family_name: 'xx', old:18}, | |
{first_name: 'bb', family_name: 'yy', old:19} | |
]; |
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
=keyframes($name) | |
@-webkit-keyframes #{$name} | |
@content | |
@-moz-keyframes #{$name} | |
@content | |
@-ms-keyframes #{$name} | |
@content | |
@keyframes #{$name} | |
@content |
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
#import <UIKit/UIKit.h> | |
#import <AVFoundation/AVFoundation.h> | |
@interface ViewController : UIViewController<AVCaptureVideoDataOutputSampleBufferDelegate> | |
@property (nonatomic, strong) AVCaptureSession* session; | |
@property (nonatomic, strong) IBOutlet UIImageView* imageView; | |
@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
def bench1000 | |
start = Time.now | |
1000.times{yield} | |
finish = Time.now | |
puts "Time: #{(finish - start).to_f}" | |
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
double cvstart = static_cast<double>(cvGetTickCount()); | |
/* Do something you would like to measure*/ | |
double cvend = static_cast<double>(cvGetTickCount()); | |
printf("processing time %f sec \n", (cvend - cvstart)/(1000000*cvGetTickFrequency())); |
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
- (UIImage *)imageFromView:(UIView *)view | |
{ | |
// 必要なUIImageサイズ分のコンテキスト確保 | |
UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, 0); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
// 画像化する部分の位置を調整 | |
CGContextTranslateCTM(context, -view.frame.origin.x, -view.frame.origin.y); | |
// 画像出力 |