- 测试多个角色在同一页面的行为(Sessions),创建chrome用户,针对角色命名,快捷键切换Ctrl/Command + Shift + m
- Rails Panel,结合meta_request gem
- Vimium
- Tampermonkey,油猴插件
- userscript
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
module CurrentUser | |
def signed_in? | |
!current_user.nil? | |
end | |
def sign_in(user) | |
self.current_user, session["user_id"] = user, user.id | |
end | |
def sign_out |
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
defmodule Fib do | |
def fib(n) when n < 2 do | |
n | |
end | |
def fib(n) when n >= 2 do | |
fib(n-1) + fib(n-2) | |
end |
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
'autologin.vbs | |
'自动打开某网站并填写表单 | |
Dim ie | |
Set ie=CreateObject("InternetExplorer.Application") '创建IE应用程序对象 | |
ie.Visible=True '设置IE窗体可见 | |
ie.Navigate "http://www.xxt.cn" '导航到相应网站 | |
While ie.busy Or ie.readystate <> 4 '等待网页加载完毕 | |
Wend | |
'填写表单并点击登录 | |
ie.document.frames(0).document.loginForm.userName.value="username" |
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
// 拿到嵌套数组的前五个 | |
(function(){ | |
var first_arr = [[1,3,4], [3,4,5,6,0], [34,56,23,56,34] [32,45]];// => [[1,3,4],[3,4]] | |
var second_arr = [[1,3,4,7], [3,4,5,6,0], [34,56,23,56,34] [32,45]]; // => [[1,3,4,7],[3]] | |
var third_arr = [[1,3,4,7,9], [3,4,5,6,0], [34,56,23,56,34] [32,45]]; // => [[1,3,4,7,9]] | |
var fourth_arr = [[1,3,4,7,9, 10], [3,4,5,6,0], [34,56,23,56,34] [32,45]]; // => [[1,3,4,7,9]] | |
function five(arr) { | |
var count = 0, result = [], left_count = 0; | |
for (var i = 0; i <= arr.length; i++) { |
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
//数字shift1,change next to last | |
//eg:1234567890 | |
// =>345678902..1 | |
// =>5678904....3 | |
// =>789046.....5 | |
// =>90468......7 | |
// =>4680.......9 | |
// =>806........4 | |
// =>60.........8 | |
// =>0..........6 |
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 City < GeoEntity | |
def self.sti_name | |
3 | |
end | |
end |
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
#!/usr/bin/env ruby | |
module_name = "Api" | |
files = Dir["*.rb"] | |
files.each do |file| | |
data = IO.read(file) | |
data.gsub!("\n", "\n ") | |
new_data = "module #{module_name}\n\n " + data + "\nend" | |
IO.write(file, new_data) | |
end |
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
# find all png-suffix images in current dir and sub dirs. | |
# use sips resize image size to 262 * 82 | |
# and make their name to *.small.png | |
find . -type f -name "*.png" -exec sips -z 82 262 '{}' --out '{}'.small.png ';' |
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
echo CapsLock::Ctrl >> caps5ctrl.ahk | |
copy /y caps5ctrl.ahk "C:\Users\annnng\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" |
OlderNewer