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
rails db:rollback STEP=1 | |
# Is a way to do this, if the migration you want to rollback is the last one applied. You can substitute 1 for however many migrations you want to go back. | |
# For example: | |
rails db:rollback STEP=5 | |
# Will also rollback all the migration that happened later (4, 3, 2 and also 1). | |
# In order to rollback a specific migration use: |
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
+__rvm_make:0> make -j 1 | |
CC = gcc | |
LD = ld | |
LDSHARED = gcc -dynamiclib | |
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe | |
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT | |
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin17 -I./include -I. | |
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -install_name /Users/jun/.rvm/rubies/ |
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
# you can call #sum iterator on it: | |
numbers = [1, 2, 3, 4, 5] | |
numbers.sum | |
# => 15 | |
# N.B: In Ruby versions < 2.4, sum didn't exist. The idiomatic way to get the same result was with #reduce: |
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
https://stackoverflow.com/a/30404532 | |
As of Swift 4 (Xcode 9), the Swift standard library provides methods to convert between Swift string ranges (Range<String.Index>) and NSString ranges (NSRange). Example: | |
let str = "a👿b🇩🇪c" | |
let r1 = str.range(of: "🇩🇪")! | |
// String range to NSRange: | |
let n1 = NSRange(r1, in: str) | |
print((str as NSString).substring(with: n1)) // 🇩🇪 |
OlderNewer