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/bash | |
| #使用vim打开文件时, 可以简单指定Vim服务器 | |
| VIM=gvim | |
| server=${s-GVIM} | |
| args="--servername ${server}" | |
| [[ "$#" != 0 && `$VIM --serverlist` == *${server^^}* ]] && \ | |
| args="$args --remote-tab" |
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
| MyValidator.addRule('integer', function(options){ | |
| var v = Number(options.element.val()); | |
| if(v && Math.floor(v) === v){ | |
| return true; | |
| } | |
| return false; | |
| }, '{{display}}必须为整数'); |
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
| // Refer: | |
| // - http://nicolasgallagher.com/micro-clearfix-hack/ | |
| // - http://nicolasgallagher.com/better-float-containment-in-ie/ | |
| // - http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified/ | |
| .clearfix() { | |
| &:before, | |
| &:after { | |
| content: " "; // 1 | |
| display: table; // 2 |
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
| window.console = window.console || {log: function(){return 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
| /** | |
| * Demo code snip: | |
| * Get tick data via jsonp api and update DOM at intervals | |
| * | |
| * `#market` is the DOM element to update; | |
| * `https://example.com/data.json` is the url to fetch tick data; | |
| * `1000*5` is the time interval for tick. | |
| */ | |
| $('#market').on('_init _tick', function(event) { |
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
| nslookup www.example.com | awk '{if($1=="Name:") {ptr_set=1}; if(ptr_set==1 && $1=="Address:"){print $2; exit}}' |
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
| server { | |
| listen 80; | |
| server_name localhost; | |
| location ~ ^/update(/.*)$ { | |
| proxy_pass http://127.0.0.1:8000$1$is_args$args; | |
| } | |
| location /api/ { | |
| # set expire timeout, in seconds |
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
| http { | |
| # ... ... | |
| proxy_cache_path /var/cache/nginx/ levels=1:2 keys_zone=api_cache:100m; | |
| server { | |
| listen 80; | |
| server_name localhost; | |
| add_header X-Upstream-Cache-Status $upstream_cache_status; |
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
| server { | |
| # ... | |
| # support some sub domains | |
| # `add_header` is not allowed in `server`, so I did the hack. | |
| if ($http_origin ~* "^https?://[\w\-]+\.example\.com$") { | |
| set $allowed_origin $http_origin; | |
| } | |
| add_header "Access-Control-Allow-Origin" $allowed_origin; |
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
| description "Meets uwsgi instance" | |
| #start on socket PROTO=inet PORT=3031 | |
| start on runlevel [2345] | |
| stop on runlevel [06] | |
| respawn | |
| setuid mama | |
| setgid mama |