Skip to content

Instantly share code, notes, and snippets.

View fdev's full-sized avatar

Folkert de Vries fdev

View GitHub Profile
@NikaBuligini
NikaBuligini / useDocumentVisibility.js
Last active February 14, 2023 12:30
useDocumentVisibility (react hook)
import React from 'react';
import useEventListener from './useEventListener';
function getVisibilityPropertyNames() {
// Opera 12.10 and Firefox 18 and later support
if (typeof document.hidden !== 'undefined') {
return ['hidden', 'visibilitychange'];
}
@DanTheMan827
DanTheMan827 / instructions.md
Created September 24, 2018 18:35
How to "unfuck" your NES/SNES classic

So, you used Hakchi2.30, fucked your console, and now it just shuts down right away... and of course you want to fix it, right?

Well, depending on which system you have, you'll have to find one of these clean kernel backups from your favorite search engine (hint: search for the filename in quotes)

Super Nintendo / Super Famicom Classic

  • kernel-dp-shvc-release-v2.0.12-0-gbff4fb3.img
  • kernel-dp-shvc-release-v2.0.14-0-gd8b65c6.img
  • kernel-dp-sneseur-release-v2.0.13-0-g9dca6c5.img
  • kernel-dp-sneseur-release-v2.0.14-0-gd8b65c6.img
  • kernel-dp-sneseur-release-v2.0.7-0-geb2b275.img
@marcgibbons
marcgibbons / concat_json_expression.py
Last active September 12, 2023 19:05
Expression to concatenate Django Postgres JSONField
from django.db.models.expressions import CombinedExpression, F, Value
from django.contrib.postgres.fields import JSONField
expression = CombinedExpression(
F('my_json_field'),
'||',
Value({'fizz': 'buzz'}, JSONField())
)
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@angstwad
angstwad / dict_merge.py
Last active December 22, 2024 16:02
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
@obfusk
obfusk / break.py
Last active November 10, 2025 05:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@jo
jo / js-crypto-libraries.md
Last active January 17, 2026 16:10
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }