- 从build入手:理解项目模块依赖关系
- 从CI/CD入手:理解项目开发-测试-发布流程
- 从测试入手:单元测试、集成测试、E2E测试
- 理解宏观架构,通读技术文档和代码
- 使用debugger跟踪代码执行核心流程
- 关注细节:一切不知道的都是需要了解的
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
const exec = require("child_process").execSync; | |
const devicePreferences = exec( | |
`/usr/libexec/PlistBuddy -c "Print :DevicePreferences" ~/Library/Preferences/com.apple.iphonesimulator.plist` | |
).toString(); | |
const regexp = /\s+([A-Za-z0-9-]+)\s=\sDict\s\{/g; | |
let matched = []; | |
while ((matched = regexp.exec(devicePreferences)) !== null) { | |
const simulatorUuid = matched[1]; | |
try { |
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 | |
# backup workbench.app's AsyncStorage filesystem, so we can restore the whole redux store for development. | |
require "open3" | |
Open3.popen3("ps ax | grep workbench.app | awk '{print $5}' ") { |stdin, stdout, stderr| | |
process_name = stdout.readlines()[0] | |
base_dir = process_name.split('/data/')[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
`brew install clang-format` | |
`clang-format -h` | |
`clang-format -i -style=Mozilla InputController.mm` | |
`clang-format -style=Mozilla -dump-config` | |
ref: http://tonyarnold.com/2014/05/31/autoformatting-your-code.html |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"workbench.colorTheme": "Monokai Dimmed", | |
"window.zoomLevel": 1, | |
"workbench.statusBar.visible": false, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, |
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
admin_constraint = lambda do |request| | |
request.env['warden'].authenticate? and not request.env['warden'].user.nil? | |
end | |
constraints admin_constraint do | |
mount Logster::Web, at: "/logs" | |
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
@max_count = 5 | |
def recursive_test(p1) | |
begin | |
if @max_count > 1 | |
raise "test" | |
else | |
@max_count + p1 | |
end | |
rescue |
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 CreateSnapShots < ActiveRecord::Migration[5.0] | |
def change | |
create_table :snap_shots do |t| | |
t.integer :user_id | |
t.string :table_name | |
t.text :table_data , limit: 4294967295 | |
t.integer :table_id | |
t.integer :snapshot_id | |
t.timestamps |
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
require 'pony' | |
=begin | |
Use gmail's smtp server to send email: | |
1. Turn on 2-Step Verification (see https://myaccount.google.com/security) | |
2. Sign in using App Passwords (see https://support.google.com/accounts/answer/185833?hl=en) | |
or alternative method: | |
1. Turn off 2-Step Verification (see https://myaccount.google.com/security) | |
2. Allow less secure apps: https://myaccount.google.com/u/0/lesssecureapps?pli=1 |
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
from flask import Flask, send_from_directory | |
app = Flask(__name__) | |
@app.route('/base/<path:filename>') | |
def base_static(filename): | |
return send_from_directory(app.root_path + '/../static/', filename) |