Skip to content

Instantly share code, notes, and snippets.

View tomsaleeba's full-sized avatar

Tom Saleeba tomsaleeba

View GitHub Profile
@cmlenz
cmlenz / babel.config.js
Created April 2, 2022 15:57
Add babel-plugin-transform-import-meta plugin in test environment only
const test = process.env.NODE_ENV === 'test';
module.exports = {
plugins: [
...(test ? ['babel-plugin-transform-import-meta'] : [])
]
};
@hanayashiki
hanayashiki / patch-arrayBuffer.js
Created December 16, 2019 04:08
Safari 13.0.4: Blob.arrayBuffer is not a function
(function () {
File.prototype.arrayBuffer = File.prototype.arrayBuffer || myArrayBuffer;
Blob.prototype.arrayBuffer = Blob.prototype.arrayBuffer || myArrayBuffer;
function myArrayBuffer() {
// this: File or Blob
return new Promise((resolve) => {
let fr = new FileReader();
fr.onload = () => {
resolve(fr.result);
@bittner
bittner / keyboard-keys.md
Created February 28, 2019 22:50
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@Gomah
Gomah / Dockerfile
Last active March 23, 2021 14:33
Nuxt.js Dockerfile :: Now.sh
FROM node:10-alpine
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
COPY yarn.lock /usr/src/app/
RUN yarn install
#!/usr/bin/env python3
"""
The idea here is to have one demo of each common argparse format
type. This is useful for me to be able to copy/paste into a new
script and have something to quickly edit and trim down to get
the functionality I need.
Expect this file to grow/change as I need new options.
This is, however, a working example. I hate examples that don't
@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
// Groovy map-reduce example
// declare a closure
def half = { it ->
it / 2
}
// declare another closure
def sum = { result, i ->
result + i
@itod
itod / split_keyboards.md
Last active March 23, 2024 21:00
Every "split" mechanical keyboard currently being sold that I know of
@rgl
rgl / wait_for_http_200.sh
Last active March 7, 2024 17:08
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76