Skip to content

Instantly share code, notes, and snippets.

View hswolff's full-sized avatar
🙃
😄

Harry Wolff hswolff

🙃
😄
View GitHub Profile
use std::fs::read_dir;
use std::path::PathBuf;
fn main() -> std::io::Result<()> {
println!("Hello, world!");
let root_path = PathBuf::from(".");
let coll = walk_files(root_path, None)?;
function useLazyAnalytics() {
const [value, setValue] = useState(() => {
return () => {
const raceError = new Error('handler called before loaded');
bugsnagClient.notify(raceError);
};
});
useEffect(() => {
import('./lazyAnalytics').then((mod) => {
@hswolff
hswolff / extensions.json
Last active July 3, 2023 01:34
Harry's Visual Studio Code Extensions, 2020
[
{
"metadata": {
"id": "d3836729-9cc1-42c1-b2af-d50071f57d29",
"publisherId": "formulahendry.auto-close-tag",
"publisherDisplayName": "formulahendry"
},
"name": "auto-close-tag",
"publisher": "formulahendry",
"version": "0.5.7"
@hswolff
hswolff / App.js
Created October 26, 2018 00:56
React Hooks: A Complete Introduction Source Code. Just use create-react-app!
import React from 'react';
import UseStateDemo from './UseStateDemo';
import UseEffectDemo from './UseEffectDemo';
import './App.css';
export default () => (
<div style={{ margin: '20px auto', padding: '20px', width: 200 }}>
<UseStateDemo />
<UseEffectDemo />
</div>
@hswolff
hswolff / rankToTop.js
Created April 3, 2018 14:27
Little Script to Rank to Top issues in a Jira Epic
async function rankNonDoneIssuesToTopInEpic(dryRun = true) {
console.warn(`Dry Run: ${dryRun ? 'ENABLED' : 'DISABLED'}`);
const issuesInEpic = Array.from(document.querySelectorAll('.nav.status'))
.filter(el => !['Resolved', 'Closed'].includes(el.textContent.trim()))
// Go from bottom up so the order remains the same
.reverse();
const sleep = (time = 1000) =>
new Promise(resolve => setTimeout(resolve, time));
@hswolff
hswolff / _config.yml.diff
Created October 21, 2016 20:02
Diff of _config from Yarn 1.x to Reptar 2.0.0
path:
source: ./
destination: ./_site
plugins: ./_plugins
themes: ./_themes
# Reptar now has support for data files!
+ data: ./_data
file:
# Support for File defaults has been added!
@hswolff
hswolff / init.lua
Created March 23, 2016 12:14
hammerspoon init.lua
-- watch for changes
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", hs.reload):start()
--
-- start custom config
--
import React, {
Component,
ART,
} from 'react-native';
const {
Group,
Shape,
Surface,
} = ART;
@hswolff
hswolff / addresses.js
Created November 11, 2015 03:36
Simple script to parse addresses from one form to another. requires at least node 4.0
"use strict";
// usage:
// cat test.csv | node addresses.js > done.csv
const headings = `name,street address,street address,city,state,country,zip`;
process.stdout.write(headings + '\n');
const deliminator = `"`;
-- include hydra-grid (https://github.com/sdegutis/hydra-grid)
require "ext.grid.init"
--
-- boilerplate hydra code
--
-- autostart hydra
hydra.autolaunch.set(true)