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
{debug && ( | |
<> | |
<pre style={{ textAlign: "left" }}> | |
<strong>Values</strong> | |
<br /> | |
{JSON.stringify(values, null, 2)} | |
</pre> | |
<pre style={{ textAlign: "left" }}> | |
<strong>Values</strong> | |
<br /> |
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
// Store Redux | |
state = { | |
cars: { | |
carsById: { | |
1: { id: 1, name "Toyota" }, | |
2: { id: 2, name "Lexus" }, | |
3: { id: 3, name "Honda" } | |
} | |
} | |
}; |
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
// Store Redux | |
state = { | |
cars: { | |
carsById: { | |
1: { id: 1, name "Toyota" }, | |
2: { id: 2, name "Lexus" }, | |
3: { id: 3, name "Honda" } | |
} | |
} | |
}; |
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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
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 'redis' | |
require 'json' | |
class CommentsRepository | |
def initialize | |
@redis = Redis.new | |
end | |
def save(itemId, comment, parentId = nil) |
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
$ git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d && git remote prune origin |
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 'factory_bot'` | |
`FactoryBot.find_definitions` |
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
async function *getRecords() { | |
const initialResponse = await getRecords(); | |
yield* initialResponse.data; | |
let nextPage = initialResponse.pagination_token; | |
while(nextPage) { | |
const response = await getRecords(nextPage); | |
yield* response.data; | |
nextPage = response.pagination_token; | |
} |
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
var Bar1 = base => class extends base { | |
componentWillMount(){ | |
super.componentWillMount(); | |
console.log('Bar1'); | |
} | |
}; | |
var Bar2 = base => class extends base { | |
componentWillMount(){ | |
super.componentWillMount(); |
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 Module | |
def with_chain(&block) | |
m = Module.new | |
m.instance_eval(&block) | |
m.methods(false).each do |name| | |
define_method name do | |
m.method(name).call | |
self | |
end |
NewerOlder