- AWSのEC2上でRails+Unicorn+Nginxを実現する
- OSはAmazon Linux AMIを使用する
sudo yum -y install gcc
sudo yum -y install make
sudo yum -y install gcc-c++
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| /* | |
| * Copyright (c) 2013 Calvin Rien | |
| * | |
| * Based on the JSON parser by Patrick van Bergen | |
| * http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html | |
| * | |
| * Simplified it so that it doesn't throw exceptions | |
| * and can be used in Unity iPhone with maximum code stripping. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining |
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
| /* Exercise: Loops and Functions #43 */ | |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func Sqrt(x float64) float64 { | |
| z := float64(2.) |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| /* | |
| Copyright (c) 2017 Chris Patuzzo | |
| https://twitter.com/chrispatuzzo | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| # app/controllers/users/password_controller.rb | |
| class Users::PasswordsController < Devise::PasswordsController | |
| def resource_params | |
| params.require(:user).permit(:email, :password, :password_confirmation) | |
| end | |
| private :resource_params | |
| end |
| - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request | |
| navigationType:(UIWebViewNavigationType)navigationType { | |
| NSString *urlString = [[request URL] absoluteString]; | |
| if ([urlString hasPrefix:@"js:"]) { | |
| NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject] | |
| stringByReplacingPercentEscapes]; | |
| NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; | |
| NSError *error; |