Skip to content

Instantly share code, notes, and snippets.

View zackshapiro's full-sized avatar

Zack Shapiro zackshapiro

View GitHub Profile
@zackshapiro
zackshapiro / fetchFollowerCounts.js
Created February 24, 2021 14:19 — forked from mtliendo/fetchFollowerCounts.js
retreive a list of followers from twitter
const cheerio = require('cheerio')
const axios = require('axios').default
async function fetchFollowerCounts(usernames) {
const followerData = usernames.map((username) => {
return axios.get(`https://mobile.twitter.com/${username}`).then((res) => {
const $ = cheerio.load(res.data)
const searchContext = `a[href='/${username}/followers']`
const followerCountString = $(searchContext)
.text()
const webpack = require('webpack');
const path = require('path');
const BabiliPlugin = require('babili-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// Config directories
const SRC_DIR = path.resolve(__dirname, 'src');
const ASSETS_DIR = path.resolve(__dirname, 'assets');
const OUTPUT_DIR = path.resolve(__dirname, 'dist');
struct CeloName {
var value: String {
#if DEBUG
return (DebugSettings().showCeloAssetName || FeatureFlags().showCeloNameEnabled) ? "CELO" : "cGLD"
#else
return FeatureFlags().showCeloNameEnabled ? "CELO" : "cGLD"
#endif
}
}
import React from 'react'
import useFileHandlers from './useFileHandlers'
import './App.css'
const Input = (props) => (
<input
type='file'
accept='image/*'
name='img-loader-input'
multiple
.container {
padding: 8px;
width: 100%;
box-sizing: border-box;
overflow-x: hidden;
}
.form {
position: relative;
width: 100%;
import React from 'react'
import useFileHandlers from './useFileHandlers'
import './App.css'
const Input = (props) => (
<input
type='file'
accept='image/*'
name='img-loader-input'
multiple
import { useCallback, useEffect, useReducer, useRef } from 'react'
const api = {
uploadFile({ timeout = 550 }) {
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, timeout)
})
},
const reducer = (state, action) => {
switch (action.type) {
case 'load':
return { ...state, files: action.files, status: LOADED }
case 'submit':
return { ...state, uploading: true, pending: state.files, status: INIT }
case 'next':
return {
...state,
next: action.next,
const reducer = (state, action) => {
switch (action.type) {
case 'load':
return { ...state, files: action.files, status: LOADED }
case 'submit':
return { ...state, uploading: true, pending: state.files, status: INIT }
case 'next':
return {
...state,
next: action.next,
const countRef = useRef(0)
// Processes the next pending thumbnail when ready
useEffect(() => {
if (state.pending.length && state.next) {
const { next } = state
api
.uploadFile(next)
.then(() => {
const prev = next