Skip to content

Instantly share code, notes, and snippets.

Working from home

Ben cloudsben

Working from home
Block or report user

Report or block cloudsben

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cloudsben /
Last active May 12, 2019
vultr VPS 搭建VPN ss

注册地址 (最好是国内的邮箱,我用的是QQ邮箱)


安装Shadowsocks 的命令


wget --no-check-certificate -O
View applescript.scpt
tell application "Google Chrome"
if not (exists window 1) then reopen
set myBMFolder to bookmark folder "xxx" of bookmark folder "其他书签"
set bmURLs to URL of bookmark items of myBMFolder
repeat with aUrl in bmURLs
tell application "Safari"
tell window 1
open location aUrl
delay 15
cloudsben / simple_form_association_collection.html.erb
Created Aug 4, 2016
simple form association collection option
View simple_form_association_collection.html.erb
<%= f.association :country, label: "请选择国家",
disabled: true, collection:{{ |c| [,, {data_country: c.short_name}] } } %>
cloudsben / is_presence.rb
Last active Jul 26, 2016
rails 查询字段是否为验证字段
View is_presence.rb
# 查询字段是否为验证字段,如果是验证字段返回 true
def presence?(poi, field)
presence_fields = do |v|
v.attributes if v.is_a? ActiveRecord::Validations::PresenceValidator
# 去 nil 并 二维转一维
if presence_fields.compact.flatten.include?(field)
return true
return false
cloudsben / is_presence
Created Jul 26, 2016
rails 查询字段是否为验证字段
View is_presence
# 查询字段是否为验证字段,如果是验证字段返回 false 不是 返回 true
def is_presence poi, field
presence_fields = do | v |
if v.is_a? ActiveRecord::Validations::PresenceValidator
# 去 nil 并 二维转一维
if presence_fields.compact.flatten.exclude?(field)
return true
cloudsben / google-map.js
Created Jul 18, 2016
google map 多 marker 自动调整 zoom 显示
View google-map.js
// 获取当前列表 经纬度
var latlngMarkerArray = <%= raw @lat_lng.to_json %>;
var markers = [];
var mapOptions = {
zoom: 10,
if(latlngMarkerArray.length > 0){
mapOptions['center'] = latlngMarkerArray[0]
cloudsben / gist:32c9dafc2f8d16abce8e
Last active Aug 29, 2015
View gist:32c9dafc2f8d16abce8e
tell application "Safari" to activate
delay 5
tell application "System Events"
repeat 240 times
key down {control}
key code 3
key up {control}
key code 124
delay 2.5
View md-menu.html
<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
<script type="text/javascript">
var tag = $(item).get(0).localName;
View tmux-config.conf
set-option -g prefix 'C-\'
setw -g mode-keys emacs
cloudsben / get_headers_by_curl.php
Last active Dec 15, 2015
View get_headers_by_curl.php
$url : the target url
$formate: if non-zero,function parses the response and sets the array's keys
return :
return example:
You can’t perform that action at this time.