Skip to content

Instantly share code, notes, and snippets.

@javascripter
javascripter / migrate-redux-saga.ts
Last active February 25, 2021 21:57
redux-saga to typed-redux-saga
/*
Description:
This script converts `yield call()` to `yield* call()` syntax and 'redux-saga/effects' to 'typed-redux-saga'
Make sure to commit your files first before you run the below script!
Usage:
npx jscodeshift --parser tsx -t ./migrate-redux-saga.ts ./sagas/**\/*.ts
Before:
@xjamundx
xjamundx / webpack-unused-files.sh
Last active November 20, 2020 12:51
Quickly identify files unused by webpack
# ----------------------------------- #
webpack --display-modules | awk '{print $2}' | grep ^\.\/ > files-processed.txt;
cd public/js/; # assumes all your files are here
find . -name "*.js" | grep -v eslint | grep -v __ > ../../files-all.txt; # excludes __tests__ and .eslintrc files
cd ../..;
cat files-all.txt | xargs -I '{}' sh -c "grep -q '{}' files-processed.txt || echo '{}'";
rm files-processed.txt files-all.txt;
# ----------------------------------- #
@staltz
staltz / introrx.md
Last active November 20, 2024 15:03
The introduction to Reactive Programming you've been missing
@acthp
acthp / loaderPlugin.js
Created August 31, 2012 19:14
requirejs (AMD) loader plugin for jstestdriver
(function() {
var loadSource = function(file, onSourceLoad) {
if (!file.fileSrc.match(/js-test/)) {
return false;
}
require([file.fileSrc], function() {
onSourceLoad({file: file, success: true, message: ''});
}, function(err) {