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 App extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| currentPage: 0, | |
| pageCount: 10, | |
| } | |
| } | |
| handlePageClick = (data) => { |
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
| from glob import glob | |
| import os | |
| import sys | |
| import argparse | |
| class AbsPathAction(argparse.Action): | |
| def __init__(self, option_strings, dest, nargs=None, **kwargs): | |
| super().__init__(option_strings, dest, **kwargs) | |
| def __call__(self, parser, namespace, values, option_string=None): |
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
| from PIL import Image | |
| import sys | |
| import os | |
| import glob | |
| thumb_size = (256, 256) | |
| def main(path): | |
| if (path[0] != '/'): |
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
| import serial | |
| import json | |
| import sys | |
| ser = serial.Serial( | |
| port='/dev/ttyUSB0',\ | |
| baudrate=9600,\ | |
| parity=serial.PARITY_NONE,\ | |
| stopbits=serial.STOPBITS_ONE,\ | |
| bytesize=serial.EIGHTBITS,\ |
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
| ''' | |
| result: | |
| books | |
| books / nl | |
| books / nl / sf | |
| books / nl / ff | |
| books / il / sf | |
| books / il / ff | |
| ''' |
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
| const WALTER_PRICE = 0.53, | |
| TARE_PRICE = 0.08; | |
| const tareMoney = (bottles) => { | |
| return TARE_PRICE * bottles; | |
| }; | |
| const round = (f) => { | |
| return Math.round(f * Math.pow(10, 2)) / Math.pow(10, 2); | |
| }; |
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
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import matplotlib | |
| import os | |
| import datetime | |
| % matplotlib inline | |
| dir_name = os.path.abspath('./') |
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
| import os | |
| import sys | |
| from subprocess import call, check_output | |
| from isort import SortImports | |
| def isort_all(): | |
| path = sys.argv[1] | |
| abs_path = os.path.abspath(path) |
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
| function nestedArrayAndObject() { | |
| // refactor this to a single line of destructuring... | |
| const info = { | |
| title: "Once Upon a Time", | |
| protagonist: { | |
| name: "Emma Swan", | |
| enemies: [ | |
| { name: "Regina Mills", title: "Evil Queen" }, | |
| { name: "Cora Mills", title: "Queen of Hearts" }, | |
| { name: "Peter Pan", title: `The boy who wouldn't grow up` }, |
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
| function formatCurrency(number) { | |
| const [integerPart, decimalPart] = `${number}`.split("."); | |
| const chunkSize = 3; | |
| const integerPartArray = integerPart.split("").reverse(); | |
| const chunks = Math.ceil(integerPartArray.length / chunkSize); | |
| const formatedInteger = Array.from(new Array(chunks), (_, idx) => { | |
| return integerPartArray | |
| .slice(idx * chunkSize, idx * chunkSize + chunkSize) | |
| .reverse() | |
| .join(""); |
OlderNewer