Skip to content

Instantly share code, notes, and snippets.

Avatar
💫
流星

impulse

💫
流星
View GitHub Profile
@impulse
impulse / lodash-webpack-plugin+0.11.5.patch
Created Dec 11, 2020
lodash-webpack-plugin webpack 5 patch
View lodash-webpack-plugin+0.11.5.patch
diff --git a/node_modules/lodash-webpack-plugin/lib/index.js b/node_modules/lodash-webpack-plugin/lib/index.js
index d791223..2aca193 100644
--- a/node_modules/lodash-webpack-plugin/lib/index.js
+++ b/node_modules/lodash-webpack-plugin/lib/index.js
@@ -84,13 +84,17 @@ function () {
/* Webpack >= 4 */
if (compiler.hooks) {
+ const webpackVersion = parseInt(require('webpack/package.json').version, 10)
+
@impulse
impulse / mp4.sh
Created Jul 14, 2020 — forked from djotto/mp4.sh
Merge multiple mp4 files as chapters
View mp4.sh
#! /usr/bin/env bash
####################################################
# Required Libraries
#
# library name | commands used | verified version
# ------------------------------------------------
# ffmpeg | ffmpeg/ffprobe | 3.1.4 3.2
# gpac | mp4box | 0.6.1
# mp4v2 | mp4chaps | 2.0.0
@impulse
impulse / mock-snippet.ts
Last active Jun 30, 2020
Mock OAuth2Client for testing (google-auth-library)
View mock-snippet.ts
import { LoginTicket, OAuth2Client, TokenPayload } from "google-auth-library";
const mockTokenPayload: TokenPayload = {
//...
}
const mockVerifyIdToken = ({
idToken,
}: {
idToken: string;
@impulse
impulse / webpack.config.js
Last active Aug 1, 2019
webpack config - figma plugin + tailwindcss
View webpack.config.js
const HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = (env, argv) => ({
mode: argv.mode === "production" ? "production" : "development",
// This is necessary because Figma's 'eval' works differently than normal eval
devtool: argv.mode === "production" ? false : "inline-source-map",
View Upload an object in memory to google cloud storage via createWriteStream wrapper
const bucket = admin.storage().bucket(testEnv.storageBucket);
const file = bucket.file(mockObject.name);
const contents = JSON.stringify(mockObject, null, 2);
file.save(contents, function(err) {
if (!err) {
// file written
}
});
@impulse
impulse / delete-all-messages.js
Created Dec 13, 2018 — forked from CarletonStuberg/delete-all-messages.js
Delete all messages in a Discord channel
View delete-all-messages.js
// Turn on Developer Mode under User Settings > Appearance > Developer Mode (at the bottom)
// Then open the channel you wish to delete all of the messages (could be a DM) and click the three dots on the far right.
// Click "Copy ID" and paste that instead of LAST_MESSAGE_ID.
// Copy / paste the below script into the JavaScript console.
// If you're in a DM you will receive a 403 error for every message the other user sent (you don't have permission to delete their messages).
var before = 'LAST_MESSAGE_ID';
clearMessages = function(){
const authToken = document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.token.replace(/"/g, "");
const channel = window.location.href.split('/').pop();
View Create a 2 Dimensional Array in JavaScript
create2DArray(rows, columns) {
var x = new Array(rows);
for (var i = 0; i < rows; i++) {
x[i] = new Array(columns);
}
return x;
}
View S3 Hash Uploader
#!/bin/bash
parentdir="$(dirname `pwd`)/games/"
for i in $parentdir*; do
for a in \\ \| \/ -; do echo -en "\r$a"; sleep 0.05; done;
hashed=$(node schemaHash.js $i);
rm -r $i/schema-*/ 2> /dev/null
mkdir -p $i/schema-$hashed/{en,de};
cp $i/data-de-latest.json $i/schema-$hashed/de/data-de-latest.json;
cp $i/data-en-latest.json $i/schema-$hashed/en/data-en-latest.json;
done
@impulse
impulse / randompi.py
Last active Sep 1, 2019
A simple script to calculate pi with random generated numbers using python3.
View randompi.py
__author__ = 'impulse'
# IMPORT
import random
# VAR
random.seed()
radius = 424242
loops = 10000
counter = 0