Skip to content

Instantly share code, notes, and snippets.

View ergunsh's full-sized avatar
🥳

Ergün Erdoğmuş ergunsh

🥳
View GitHub Profile
@ergunsh
ergunsh / codecs.ts
Created August 6, 2021 12:36
codecs.ts libSquoosh with encode types
import { promises as fsp } from 'fs';
import { instantiateEmscriptenWasm, pathify } from './emscripten-utils.js';
import { threads } from 'wasm-feature-detect';
import { cpus } from 'os';
// We use `navigator.hardwareConcurrency` for Emscripten’s pthread pool size.
// This is the only workaround I can get working without crying.
(globalThis as any).navigator = {
hardwareConcurrency: cpus().length,
};
@ergunsh
ergunsh / index.html
Created August 23, 2018 03:51
Electron Fiddle Gist
<!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>,
@ergunsh
ergunsh / index.html
Created August 23, 2018 03:34
Electron Fiddle Gist
<!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>,
@ergunsh
ergunsh / remove-local-branches-not-in-remote.sh
Created February 14, 2018 10:21
Git tip: Have a lot of old branches on your machine? Here's a Bash script that removes local branches that are no longer remote
# Thanks to Cory House (@housecor) https://twitter.com/housecor/status/961942463006027776
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@ergunsh
ergunsh / pre-commit.sh
Created December 5, 2017 14:59
Pre-commit hook for ESLint error checks
#!/usr/bin/env bash
set -e
# allow being run from somewhere other than the git rootdir
gitroot=$(git rev-parse --show-cdup)
# default gitroot to . if we're already at the rootdir
gitroot=${gitroot:-.};
nm_bin=$gitroot/node_modules/.bin
cat $1 | sed -e 's/ */#/g' | grep error | grep "#" | tr -d '0123456789.:' | cut -d "#" -f5 | sort | uniq -c | sort -bgr