Skip to content

Instantly share code, notes, and snippets.

Avatar
🗑️

Charlie Hess CharlieHess

🗑️
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am CharlieHess on github.
  • I am chess (https://keybase.io/chess) on keybase.
  • I have a public key whose fingerprint is BAB8 B831 7A5E 18E9 9460 BE8B 7CD2 4F2D 402C C81A

To claim this, I am signing this object:

@CharlieHess
CharlieHess / oldFashionedProcedural.js
Last active Aug 26, 2015
Old Fashioned Procedural Ways
View oldFashionedProcedural.js
doABettingRound(players) {
for (let player of players) {
tellThatPlayerToAct(player);
startATimer(timerCallback);
seeIfTheySentAMessage(messageCallback);
}
}
...
View rxIsFire.js
let timeExpired = rx.Observable.timer(0, 1000, scheduler)
.take(timeout + 1)
.publishLast();
let newPlayers = messages.where(e => e.text && e.text.toLowerCase().match(/\byes\b/))
.map(e => e.user)
.distinct()
.take(maxPlayers)
.publish();
@CharlieHess
CharlieHess / sign-in-window.js
Last active Sep 28, 2017
A redux-observable epic that handles first time sign-in
View sign-in-window.js
import { BrowserWindow } from 'electron';
import { REHYDRATE } from 'redux-persist/constants';
import { getWorkspacesCount } from '../reducers/workspaces';
const signInWindowEpic = (action$, store) => {
// Rehydrate is just a $10 word for "we loaded saved state from a file"
// Since we're a redux-persist app, it's one of the first actions that occurs
return action$.ofType(REHYDRATE)
.filter(() => getWorkspacesCount(store) > 0)
.map(() => createSignInWindow(store))
View notification-actions.js
import { webContents as WebContents } from 'electron';
import { NOTIFICATIONS } from '../constants/actions';
import {
notificationClickCode,
notificationReplyCode
} from '../constants/code';
/**
* An epic that executes some code in the guest page when the user clicks or
* replies to a native notification.
@CharlieHess
CharlieHess / tally-workspace-usage.js
Last active Sep 27, 2017
An Epic that tallies time spent in workspaces
View tally-workspace-usage.js
/**
* Keep a running total of time spent on each workspace and, once the app is quit,
* fire an action that updates the usage property in the store.
*/
const tallyWorkspaceUsageEpic = (action$, store, scheduler) => {
return selectionChangedObservable(action$, store)
.timeInterval(scheduler)
.pairwise()
.reduce(usagePayloadFromIntervals, {})
.map((payload) => ({
@CharlieHess
CharlieHess / tally-workspace-usage.spec.js
Last active Sep 30, 2017
A test for the workspace usage epic
View tally-workspace-usage.spec.js
import { rxSandbox } from 'rx-sandbox';
import { tallyWorkspaceUsageEpic } from '../epics/tally-workspace-usage';
describe('tallyWorkspaceUsageEpic', () => {
it('should accumulate time until the app is quit', () => {
const { hot, flush, getMessages, e } = rxSandbox.create();
const w = { type: WORKSPACE.SELECTION_CHANGED, payload: 'Hiro' };
const x = { type: WORKSPACE.SELECTION_CHANGED, payload: 'Fiona' };
View stardew-valley-gifting-guide.md
Gift Your ex-roommate The townsfolk
Beer
Homecooked meals
Grass
"Grass"
Rare crystals
"Rare crystals"
@CharlieHess
CharlieHess / app-store-builds.ts
Created Jul 11, 2019
Proof of concept for making App Store Connect requests
View app-store-builds.ts
/* tslint:disable: no-console */
import * as fs from 'fs-extra';
import { sign } from 'jsonwebtoken';
import { memoize, take } from 'lodash';
import fetch from 'node-fetch';
import * as path from 'path';
const KEY_ID = 'XXXXSECRET';
const ISSUER_ID = 'secret-xxxx-xxxx-xxxx-secret';
@CharlieHess
CharlieHess / index.html
Created Sep 5, 2019
Proxy BrowserWindow with allowed methods
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,