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
// 还需要了解的: | |
// - 什么是 UID | |
// - 这四种方式优劣 | |
function getId() { | |
return "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/x/g, function() { | |
return Math.floor(Math.random()*16).toString(16).toUpperCase(); | |
}); | |
} |
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
define(function(require, exports) { | |
var TAB_WIDTH = 2; | |
var str_helper = require('./string'); | |
function squeeze(str) { | |
return str.replace(/^[ \n\t]+/, '').replace(/\>[\n\t ]+/g, '>'); | |
} |
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 River | |
DEFAULT_CONFIG = { | |
:root => 'cc', | |
:base => Rails.root.join('public'), | |
:preloads => ['ent'] | |
} | |
def initialize(attrs = nil) | |
attrs ||= DEFAULT_CONFIG.dup |
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
{% for category in site.categories %} | |
{% if page.categories contains category[0] %} | |
<section> | |
<h3>{{ category | first | capitalize }}</h3> | |
{% assign posts = category[1] %} | |
</section> | |
{% endif %} | |
{% endfor %} |
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
$gridGutterWidth: 10px; | |
$gridColumnWidth: 10px; | |
$gridColumns: 50; | |
$gridRowWidth: ($gridColumns * $gridColumnWidth) + ($gridGutterWidth * ($gridColumns - 1)); | |
.row { | |
margin-left: $gridGutterWidth * -1; | |
*zoom: 1; | |
&:before, | |
&:after { |
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
// Usage: | |
// | |
// seajs.use('style_parser', function(parser) { | |
// var console.log(parser.parse('body { padding: 0; margin: 0 }')) | |
// }) | |
// | |
// will output: | |
// { | |
// "body": { | |
// "padding": 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
#!/bin/bash | |
last_ip="" | |
tail -f /var/log/vsftpd.log | while read LINE; do | |
{ | |
if [[ "${LINE}" =~ "FAIL LOGIN" ]]; then | |
ip="$(echo ${LINE} | awk '{ip=$NF;gsub(/\"/,"",ip);print ip}')" | |
if [[ "$last_ip" == "$ip" ]]; then | |
echo "block $ip" | |
iptables -A INPUT -s "$ip" -j DROP | |
fi |
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
# 2013-03-17 刚才不小心更新了一下 curl | |
sudo pacman -S curl | |
# 结果 curl 跪了,所有的 pacman 命令也是 | |
curl: /usr/lib/libc.so.6: version `GLIBC_2.17' not found (required by curl) | |
curl: /usr/lib/libc.so.6: version `GLIBC_2.17' not found (required by /usr/lib/libcurl.so.4) | |
# 于是很悲剧地连回滚 curl 都不行,幸好找到了不通过 pacman 命令回滚软件的方式 | |
# https://bbs.archlinux.org/viewtopic.php?pid=1148260#p1148260 | |
zcat /var/cache/pacman/pkg/curl-7.26.0-1-<arch>.pkg.tar.xz | tar xv -C / |
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
# https://bbs.archlinux.org/viewtopic.php?id=49632 | |
# rmagick 的 lib 文件检测机制太老,找不到新版本的 imagemagick(~> 6.8.0), | |
# 回退到旧版本就好了 | |
sudo pacman -U /var/cache/pacman/pkg/imagemagick-6.7.8.9-1-i686.pkg.tar.xz |
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
# encoding: utf-8 | |
# config/deploy.rb | |
# | |
# - 使用 Unicorn | |
# - 链接 rabel 的配置文件和用户上传内容 | |
# - 使用 RVM | |
# Add RVM's lib directory to the load path. | |
require "rvm/capistrano" |
OlderNewer