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
| def run_in_browser(js, html) | |
| jsfile = Tempfile.new(['js', '.js']) | |
| jsfile.write(js) | |
| jsfile.close | |
| htmlfile = Tempfile.new(['test', '.html']) | |
| htmlfile.write(html) | |
| htmlfile.close | |
| Phantomjs.run(jsfile.path, htmlfile.path) |
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
| 1.cap staging deploy -s branch=1626d55d3da9 | |
| 2.cap staging deploy:rollback #rollback to the previous version | |
| 3.添加新的任务-显示服务器当前的代码版本号。在config/deploy.rb文件添加如下代码 | |
| namespace :deploy do | |
| desc 'Show deployed version' | |
| task :revision do | |
| on roles(:app) do | |
| execute "echo current version is------------------" | |
| execute "cat #{current_path}/REVISION" | |
| execute "echo end----------------" |
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
| // get chart object in javascript | |
| var chart = $("#chart_container_id").highcharts(); | |
| // fire click event of first point | |
| chart.series[0].data[0].firePointEvent('click'); |
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
| SECTION1 - Rails | |
| 1.Enumerable inject用法:User.limit(2).inject({}) {|h, u| h[u.id]=u.email;h} #return {1=>"[email protected]", 2=>"[email protected]"}; | |
| 2.查看所有precompile的assets文件 y Rails.application.config.assets.paths | |
| 3..gitignore没有作用的解决方法 | |
| git rm . -r --cached | |
| git add . | |
| git commit -m "fixed untracked files" | |
| 4.install fish shell on ubuntu | |
| #install fish shell | |
| sudo apt-add-repository ppa:fish-shell/release-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
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| " let Vundle manage Vundle, required | |
| Plugin 'gmarik/Vundle.vim' | |
| Plugin 'https://github.com/rking/ag.vim.git' | |
| Plugin 'https://github.com/mattn/gist-vim.git' | |
| Plugin 'https://github.com/mattn/webapi-vim.git' | |
| Plugin 'https://github.com/Yggdroot/indentLine.git' | |
| Plugin 'https://github.com/yegappan/mru.git' |
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
| unbind C-s | |
| set -g status on | |
| set -g prefix C-a | |
| set additional_escapes tmux | |
| set -g base-index 0 | |
| bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
| # retain current PWD when open new window |
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
| # 生成公钥,一路回车到底 | |
| ssh-keygen -t rsa | |
| # 上传公钥 | |
| cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys" |
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 | |
| #OpenVPN Server on CentOS OpenVZ VPS Script by Yasyf Mohamedali (http://blog.yasyf.com/2012/08/01/openvpn-server-on-a-centos-openvz-vps) | |
| #Adapted from various scripts around the net, including http://www.openvz.ca/blog/2010/11/18/setup-tuntap-openvpn-server-openvz-5-minutes/ | |
| #https://gist.github.com/3230440 | |
| tunstate=`cat /dev/net/tun` | |
| if [ "$tunstate" = "cat: /dev/net/tun: Permission denied" ] | |
| then | |
| clear | |
| echo "Sorry, but it seems that TUN/TAP is not enabled on your VPS." | |
| 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
| #include "keymap_common.h" | |
| #include "led.h" | |
| #include "action_layer.h" | |
| /* | |
| * HHKB Layout | |
| */ | |
| const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
| /* 0: Default layer | |
| * ,-----------------------------------------------------------. |