This file contains hidden or 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
| log_format complete '[$time_local] REQ_TIME:$request_time UPS_TIME:$upstream_response_time C:$remote_addr H:$host ' | |
| 'URI:$request_uri ($request_method) ST:$status SZ:$bytes_sent ' | |
| 'REFERER:http_referer AGENT:$http_user_agent'; |
This file contains hidden or 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
| Index: sapi/cli/config.w32 | |
| =================================================================== | |
| --- sapi/cli/config.w32 (revision 308839) | |
| +++ sapi/cli/config.w32 (working copy) | |
| @@ -6,7 +6,8 @@ | |
| ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no'); | |
| if (PHP_CLI == "yes") { | |
| - SAPI('cli', 'php_cli.c', 'php.exe'); | |
| + SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe'); |
This file contains hidden or 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
| SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" | |
| FROM information_schema.TABLES GROUP BY table_schema; |
This file contains hidden or 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
| user nginx; | |
| worker_processes 5; | |
| error_log /var/log/nginx.error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| } | |
This file contains hidden or 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 'json' | |
| require 'hpricot' | |
| require 'open-uri' | |
| module SimpleFlickr | |
| AUTH_URL = 'http://flickr.com/services/auth/'.freeze | |
| API_URL = 'http://api.flickr.com/services/rest/'.freeze | |
| # USAGE |
This file contains hidden or 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 | |
| a = [1,2,3,4,5], | |
| b = [2,3], | |
| subset_of = function(arr, arr_sub) { return new RegExp("-" + arr_sub.join('-') + "-").test("-" + arr.join('-') + "-"); }; | |
| console.log(subset_of(a, b)); // true | |
| console.log(subset_of(a, b.reverse())); // false |
This file contains hidden or 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' | |
| class Hash | |
| def hash_from_1(*keys) | |
| keys.inject({}) { |memo, obj| memo.merge(obj => self[obj]) } | |
| end | |
| def hash_from_2(*keys) | |
| self.dup.delete_if { |k, v| !keys.include? k } |
This file contains hidden or 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' | |
| class Hash | |
| def hash_from_1(*keys) | |
| keys.inject({}) { |memo, obj| memo.merge(obj => self[obj]) } | |
| end | |
| def hash_from_2(*keys) | |
| self.dup.delete_if { |k, v| !keys.include? k } |
This file contains hidden or 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 Hash | |
| def hash_from(*keys) | |
| keys.inject({}) { |memo, obj| memo.merge(obj => self[obj]) } | |
| end | |
| end | |
| # example: | |
| # >> a = {:foo => 1, :bar => 2, :foobar => 3} |
This file contains hidden or 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 | |
| # Usage: unicorn_github | |
| # Script used to start unicorn in GitHub staging and production environments. | |
| # This is called primarily by god. | |
| set -e | |
| # configure GC settings | |
| export RUBY_HEAP_MIN_SLOTS=800000 | |
| export RUBY_HEAP_FREE_MIN=100000 | |
| export RUBY_HEAP_SLOTS_INCREMENT=300000 |