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
export const moveBoxCorner = (box: BoundingBox, newCorner: Point) => { | |
if (box.resizingCorner === 'topLeft') { | |
return { | |
...box, | |
startX: newCorner.x, | |
startY: newCorner.y, | |
width: box.width + box.startX - newCorner.x, | |
height: box.height + box.startY - newCorner.y | |
} | |
} else if (box.resizingCorner === 'topRight') { |
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 NotesList = () => { | |
const [notes, setNotes] = useState([{tile: '...', text: '...'}]); | |
const saveNote = (noteId, newData) => { | |
// api call here | |
setNotes(oldNotes => oldNotes.map(note => note.id === noteId ? {...newData} : note)); | |
} | |
return ( | |
<div>{notes.map(note => <Note note={note} saveNote={(newData) => saveNote(note.id, newData)}/>)}</div> |
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
{() => Object.entries(this.state.lastAdded).length === 0 && false ? '' : ( | |
<div> | |
<h4>Last Added</h4> | |
<p>Excercise: {this.state.lastAdded.excercise}</p> | |
<p>Reps: {this.state.lastAdded.reps}</p> | |
<p>Weight: {this.state.lastAdded.weight} kg</p> | |
<p>Time Length: {this.state.lastAdded.timeLength}</p> | |
<p>Notes: {this.state.lastAdded.notes}</p> | |
</div> | |
)} |
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 restart(self): | |
restart_all_messages = not self.filters | |
while True: | |
if not restart_all_messages and not self.filters: | |
return | |
messages = self._retrieve_messages() | |
if not messages: | |
return |
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 ProductDataExtractor: | |
def __init__(self, response): | |
self.response = response | |
def extract_data(self): | |
pass | |
def get_title(self): | |
return self.response.xpath('//*[@id="productTitle"]/text()').strip() |
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
import re | |
import scrapy | |
product = { | |
'url': 'https://www.amazon.co.uk/Asmodee-ASMDOBB01EN-Dobble-Card-Game/dp/B0031QBHMA/' | |
} | |
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
{"lastUpload":"2019-02-02T20:14:15.023Z","extensionVersion":"v3.2.4"} |
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 | |
class MegaGreeter | |
attr_accessor :names | |
def initialize(names = 'World') | |
@names = names | |
end | |
def say_hi |
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 curry(func, *args) | |
def wrapped(*new_args) | |
args = args.concat new_args | |
if args.length == func.arity | |
func.call(*args) | |
else | |
curry func, args | |
end | |
end | |
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
myPromise | |
.then(() => { | |
// ... | |
}) | |
.then(() => { | |
// ... | |
}) | |
.catch(() => { | |
// .. | |
}); |
NewerOlder