Skip to content

Instantly share code, notes, and snippets.

View coreylight's full-sized avatar
🚚
Up and up

Corey Light coreylight

🚚
Up and up
View GitHub Profile
@jgautheron
jgautheron / CategorySagas.js
Created March 22, 2017 19:07 — forked from pesakitan22/CategorySagas.js
Redux-Saga for next.js
import {call, put, take, fork} from 'redux-saga/effects'
import {END} from 'redux-saga'
import CategoryActions, {CategoryTypes} from '../Redux/CategoryRedux'
// attempts to fetch category
export function* fetchCategoryServer (api) {
let action = yield take(CategoryTypes.CATEGORY_SERVER)
// check when it stopped
while (action !== END) {
yield fork(fetchCategoryAPI, api)
@kndt84
kndt84 / authorize.js
Last active April 10, 2024 15:15
Sample code: how to refresh session of Cognito User Pools with Node.js and Express
const AWS = require('aws-sdk');
const CognitoUserPool = require('amazon-cognito-identity-js-node').CognitoUserPool;
const CognitoUserSession = require('amazon-cognito-identity-js-node').CognitoUserSession;
const CognitoUser = require('amazon-cognito-identity-js-node').CognitoUser;
const CognitoIdToken = require('amazon-cognito-identity-js-node').CognitoIdToken;
const CognitoAccessToken = require('amazon-cognito-identity-js-node').CognitoAccessToken;
const CognitoRefreshToken = require('amazon-cognito-identity-js-node').CognitoRefreshToken;
const cfg = require('config').config;
const COGNITO_IDENTITY_POOL_ID = cfg.COGNITO_IDENTITY_POOL_ID;
@Rich-Harris
Rich-Harris / service-workers.md
Last active May 6, 2024 22:10
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@ma2shita
ma2shita / awsiot_thing_shadow_core.html
Created May 8, 2016 11:08
AWS IoT's Thing Shadow access w/ Websocket over MQTT and Cognito
<!--
AWS IoT's Thing Shadow access w/ Websocket over MQTT and Cognito
-->
<script type="text/javascript" src="https://sdk.amazonaws.com/js/aws-sdk-2.3.9.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha256.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/ma2shita/2c5a4c29242dd5382b05ce941731fd41/raw/eb4bc16c02e7a72bbd0086e937050c258da09a20/sigv4utils.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/ma2shita/63fb1dfd07753dc1ff67fe98132c0bc0/raw/ef50f3ec3276dd1c5dd90a3003e5105045b837e2/mqttws31.js"></script>
<script>
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus