💯 👍 👎 🔢 🎱
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
// 提高性能 | |
// 让rails server只处理动态请求,不必浪费资源处理静态文件请求 | |
// rails server处理静态文件的性能完全不能和nginx,apache之类的比。 | |
location ~* ^/(images|javascripts|stylesheets|img)/ { | |
access_log off; | |
log_not_found off; | |
expires max; | |
break; | |
} |
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
# sudo ln -s ~/nginx.conf unicorn.conf | |
upstream app_server { | |
server unix:/tmp/unicorn_padrino.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
charset utf-8; | |
server_name db.innshine.com; |
The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render
in a controller when we want to respond within the current request, and redirect_to
when we want to spawn a new request.
The render
method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form'
or render @post.comments
, but here we'll focus on usage within the controller.
// composer.phar是二进制文件
// 它是一个PHAR (PHP archive),PHP的归档格式,也可以像其他命令一样在命令行上运行。
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
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
<?php | |
/* | |
*--------------------------------------------------------------- | |
* APPLICATION ENVIRONMENT | |
*--------------------------------------------------------------- | |
* | |
* You can load different configurations depending on your | |
* current environment. Setting the environment also influences | |
* things like logging and error reporting. |
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 A{ | |
public B b; | |
} | |
class B{ | |
public A a; | |
} | |
public class Main{ | |
public static void main(String[] args){ | |
A a = new A(); |
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
zh-CN: | |
admin: | |
home: | |
name: "首页" | |
pagination: | |
previous: "« 上一页" | |
next: "下一页 »" | |
truncate: "…" | |
misc: | |
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done! |
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 'digest/sha1' | |
require 'base64' | |
# client request | |
# GET / HTTP/1.1 | |
# Upgrade: websocket | |
# Connection: Upgrade | |
# Host: example.com | |
# Origin: null | |
# Sec-WebSocket-Key: sN9cRrP/n9NdMgdcy2VJFQ== |
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
httping -g URL -C "key=value" -s -c 5 |
OlderNewer