Skip to content

Instantly share code, notes, and snippets.

View caok's full-sized avatar

Clark caok

View GitHub Profile
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install Oracle-java8-installer
完成之后可以通过以下命令来查看版本:
javac -version
brew install app
brew uninstall app
brew uninstall neovim --force
brew prune
brew info app
brew list
brew update
@caok
caok / ssh.md
Last active May 31, 2016 08:06
关闭SSH传统密码登陆方式

如果登陆失败,请检查ssh配置文件(/etc/ssh/sshd_config)中的PubkeyAuthentication是否为yes。

如果验证成功的话就可以关闭密码登陆方式了,编辑/etc/ssh/sshd_config,将PasswordAuthentication改为no,

ChallengeResponseAuthentication改为no,不过需要重启sshd(service sshd restart)后才能生效。

@caok
caok / gist:8975e8d23d22dcb09aa4
Created June 16, 2015 07:36
check dateformat
#mm/dd/yyyy
function checkdateformat(date) {
var dateformat = /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
if(date.match(dateformat)){
var splitdate= date.split('/');
var dd = parseInt(splitdate[0]);
var mm = parseInt(splitdate[1]);
var yy = parseInt(splitdate[2]);
rbenv sudo unicorn_rails -c config/unicorn1.rb -D -E production
ps aux | grep unicorn | awk '{print $2}' | sudo xargs kill -s 9
RAILS_ROOT = File.expand_path("../..", __FILE__)
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 240

How to install PhantomJS on Ubuntu

Version: 1.9.7

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
安装 MongoDB
  sudo apt-get install mongodb
关闭/启动
  sudo service mongodb stop
  sudo service mongodb start
设置数据库连接密码:
  在跟目录创建文件夹: data/db
render(:json => {:comment_html => render_to_string(:partial => "admin/comments/comment", :locals => {:comment => new_comment})}) and return
$("body")
.on('ajax:success', 'form.comment_form', function(e, response, status, xhr) {
var parent_id = $(this).data('parent_id');
this.reset();
var comment_list = parent_id ? $(".comments_"+parent_id) : $(this).siblings('ul.comments');
comment_list.prepend(response.comment_html);
var comments_count = $(".comments_count_"+parent_id);
comments_count.html((1*comments_count.html())+1);
查找有engagements的project
Project.joins(:engagements).select(["projects.id", "projects.title", "engagements.id as eid"])