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
def rollback(migrations_path) | |
migrations_paths_was = ActiveRecord::Migrator.migrations_paths | |
ActiveRecord::Migrator.migrations_paths = [migrations_path] | |
ActiveRecord::Tasks::DatabaseTasks.check_target_version | |
scope = ENV["SCOPE"] | |
verbose_was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, ActiveRecord::Tasks::DatabaseTasks.send(:verbose?) | |
ActiveRecord::Base.connection.migration_context.down(ActiveRecord::Tasks::DatabaseTasks.target_version) do |migration| | |
scope.blank? || scope == migration.scope |
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
type unionFind struct { | |
parent []int | |
rank []int | |
boundedNode map[int] bool | |
} | |
func NewUnionFind(board [][]byte) *unionFind { | |
m := len(board) | |
n := len(board[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
{ | |
"name": "ant-design-pro", | |
"version": "1.0.0", | |
"private": true, | |
"description": "An out-of-box UI solution for enterprise applications", | |
"scripts": { | |
"analyze": "cross-env ANALYZE=1 umi build", | |
"build": "umi build", | |
"deploy": "cross-env ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION=site npm run site && npm run gh-pages", | |
"fetch:blocks": "pro fetch-blocks", |
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
yarn upgrade v1.17.3 | |
[1/5] Validating package.json... | |
[2/5] Resolving packages... | |
warning @ant-design/pro-layout > antd > rc-tree-select > rc-trigger > rc-animate > fbjs > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2. | |
warning dva > react-router-redux@5.0.0-alpha.9: This project is no longer maintained. | |
warning dva > dva-core > flatten@1.0.2: I wrote this module a very long time ago; you should use something else. | |
warning umi > umi-build-dev > umi-notify > is-ali-env > superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header). This notice will go away with v5.0.2+ once it is released. | |
warning umi > umi-build-dev > umi-test > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart() | |
warning umi-plugin-react > umi-plugin-dva > dva > dva-core > flatt |
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
// s = "catsandog" | |
// wordDict = ["cats", "dog", "sand", "and", "cat"] | |
// dp[0] = "" => true | |
// dp[1] = "c" => false | |
// dp[2] = "ca" => false | |
// dp[3] = "cat" -> dp[0] && wordMap["cat"] => true | |
// dp[4] = "cats" -> dp[0] && wordMap["cats"] => true | |
// dp[5] = "catsa" => false | |
// dp[6] = "catsan" => false | |
// dp[7] = "catsand" -> dp[3] && wordMap["sand"] => 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
// [9,0,3,5,7] | |
// When num = 9, size = 16, i = 7, there will be a strange issue: | |
// ans[15][3] 7 -> 9 | |
func subsets(nums []int) [][]int { | |
sort.Ints(nums) | |
// fmt.Println(nums) | |
ans := make([][]int, 0) | |
ans = append(ans, []int{}) |
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
# s[i..j] | |
# dp[i][j] = (s[i] == s[j]) && (j - i <= 2 || dp[i + 1, j - 1]) | |
# @param {String} s | |
# @return {String} | |
def longest_palindrome(s) | |
return s if s.size <= 1 | |
longest_size = 1 | |
longest_s = s[0] |