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 React from 'react' | |
import Button from './components/Button' | |
const App = () => { | |
const subscribe = () => { | |
// ... | |
} | |
return <Button onClick={() => subscribe}>Subscribe</Button> | |
} |
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
#!/bin/bash | |
pip freeze > requirements.txt | |
deactivate | |
rm -rf ./venv | |
python3 -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt |
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 aiohttp | |
import asyncio | |
import aiofiles | |
import io | |
from PIL import Image | |
# put your access key here or change "us_api_url" to omit it | |
ACCESS_KEY = "_" |
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
use std::io::{self, prelude::*}; | |
use std::thread; | |
use std::time::Duration; | |
struct Loader<I> { | |
iter: I, | |
len: usize, | |
progress: usize, | |
} |
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 React from 'react' | |
import { Button, Input } from 'semantic-ui-react' | |
function CopyInput({ value, label }) { | |
const input = React.createRef() | |
function handleClick() { | |
input.current.select() | |
// input.current.setSelectionRange(0, 99999) | |
document.execCommand('copy') |
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 axios from 'axios' | |
import { useEffect, useState } from 'react' | |
export default function(url) { | |
const [state, setState] = useState({ status: 'pending' }) | |
useEffect(() => { | |
axios | |
.get(url) | |
.then((res) => { |
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
fn perms<T: Clone>(values: &[T], perm_len: usize) -> Vec<Vec<T>> { | |
let mut out = Vec::new(); | |
perms_inner(&mut out, &values, Vec::with_capacity(perm_len), perm_len); | |
return out; | |
} | |
fn perms_inner<T: Clone>(out: &mut Vec<Vec<T>>, values: &[T], perm: Vec<T>, perm_len: usize) { | |
if perm.len() == perm_len { | |
out.push(perm); | |
return; |
NewerOlder