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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
find /path/to/img/dir -type f -exec sh -c ' | |
sudo convert -resize 150% "$0" "$0" | |
' {} \; |
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 logging | |
#SET LOG NAME: | |
logname = "article_cleaner.log" | |
logger = logging.getLogger() | |
fhandler = logging.FileHandler(filename=logname, mode='a') | |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
fhandler.setFormatter(formatter) | |
logger.addHandler(fhandler) | |
logger.setLevel(logging.DEBUG) |
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 Koa from 'koa' | |
import convert from 'koa-convert' | |
import webpack from 'webpack' | |
import webpackConfig from '../build/webpack.config' | |
import historyApiFallback from 'koa-connect-history-api-fallback' | |
import serve from 'koa-static' | |
import proxy from 'koa-proxy' | |
import _debug from 'debug' | |
import config from '../config' | |
import webpackDevMiddleware from './middleware/webpack-dev' |
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 main() { | |
for (let item of iterable) { | |
try { | |
const res = await fetch('http://www.example.com', { method: 'HEAD' }) | |
} catch (e) { | |
console.error(e) | |
} | |
} | |
} |
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 sort of filter function that returns every value that matches a provided path | |
if you know the path of the node you want, use the function in the other file--it'll be faster */ | |
var JSONStream = require('JSONStream') | |
var fs = require('fs') | |
// use immutable for easier assigning of deeply nested props | |
var Immutable = require('immutable') | |
var writeJSON = require('simple-json-writing-util.js') | |
var M = Immutable.Map({}) |
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
// @flow | |
import React from 'react' | |
import Joyride from 'react-joyride' | |
import tourSteps from './steps' | |
import 'styles/joyride.css' | |
type State = { | |
tourType: 'single' | 'continuous', | |
showOverlay: boolean, | |
tourRun: boolean, |
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
/* When run in the Chrome console, this function clicks all of the 'unsubscribe' buttons | |
* on the 'Edit Subscriptions' screen of https://unroll.me/a/subscriptions/new */ | |
const unsubs = [...document.querySelectorAll('.btn.btn--link')].filter( | |
// collect all the buttons on the page | |
b => b.textContent === 'Unsubscribe' | |
); // filter down to just the Unsubscribe buttons | |
// this function will pause after each click for 750ms to respect their servers | |
const sleep = () => new Promise(resolve => setTimeout(resolve, 750)); |
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 Icon = props => ( | |
<svg | |
height={props.height + 'px'} | |
width={props.width + 'px'} | |
style={props.style} | |
viewBox="0 0 89.62 92.78" | |
> | |
<g id="Layer_1-2" data-name="Layer 1"> | |
<path | |
style={{ |
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 works in the chrome console at the messenger.com interface, eg | |
// https://www.messenger.com/t/yourfriendsname | |
/* first scroll to top, then copy all msgs, timestamps and names. | |
* it doesn't scroll "to the top" strictly speaking, but instead just | |
* scrolls a few times (that's all we needed for our use case). | |
* you can adjust the # of times it scrolls by extending | |
* SCROLL_COUNT in scrollToTop(). | |
* results are in TSV format with no header row, eg, |
OlderNewer