- Don't multitask (be present, be in that moment)
- Don't pontificate
- Use open-ended questions
- Go with the flow
- If you don't know, say that you don't know
- Don't equate your experience with theirs (it's never the same, all experiences are individual)
- Try not to repeat yourself
- Stay out of the weeds (people don't care about details)
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
// same arg type and return type | |
withUID<T>(obj: T) | |
// "extends" helps providing some constraints | |
// eg <T extends object> | |
withUID({a: 1}) // valid | |
withUID("wrong way") // NOT valid | |
// default value type (string) | |
A<T=string> { name: T } |
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
class Router | |
Route = Struct.new(:pattern, :block) | |
class RouteSet | |
def on(pattern, &block) | |
Router.routes.push Route.new(pattern, block) | |
end | |
end | |
@routes = [] |
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
❯ react-native run-ios --simulator="iPhone 7" | |
Found Xcode workspace Nabobil.xcworkspace | |
Could not find iPhone 7 simulator | |
Error: Could not find iPhone 7 simulator | |
at resolve (...) | |
sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js |
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
# error: Build input file cannot be found: '/Users/sobstel/Projects/nabobil/nabobil-mobile/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc' | |
cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../ | |
cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../ |
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
class Data < ApplicationRecord | |
class << self | |
def bulk_upsert(values) | |
transaction do | |
values.uniq { |v| v[:key] }.each_slice(1000) do |values_slice| | |
connection.exec_query <<-SQL.squish | |
INSERT INTO #{table_name}(#{upsert_columns.join(', ')}) | |
VALUES #{upsert_values_statement(values_slice)} | |
ON CONFLICT(key) | |
DO UPDATE SET |
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
# taken from https://mrbrdo.wordpress.com/2013/09/25/manually-preloading-associations-in-rails-using-custom-scopessql/ | |
# collection association e.g. has_many | |
owners = People.all | |
association_name = :photos | |
owners.each do |owner| | |
records = Array(whatever_you_want) | |