Skip to content

Instantly share code, notes, and snippets.

View entepe85's full-sized avatar
😎

Nils Torbjörn Petersen entepe85

😎
View GitHub Profile
@cassidoo
cassidoo / simple-react-recorder.jsx
Last active November 10, 2024 04:59
A simple React microphone component, recording audio and showing the blob in the browser, styled with Tailwind.
"use client";
import { useState, useEffect, useRef } from "react";
function SimpleRecordButton() {
const [isRecording, setIsRecording] = useState(false);
const [audioStream, setAudioStream] = useState(null);
const [mediaRecorder, setMediaRecorder] = useState(null);
const [audioBlob, setAudioBlob] = useState(null);
const [recordingTime, setRecordingTime] = useState(0);
const timerRef = useRef(null);

Moved to repo: /quenhus/uBlock-Origin-dev-filter

In order to keep filters up to date, please use this repo.

@erickpatrick
erickpatrick / init.vim
Last active September 10, 2024 15:30
Neovim CoC Intelephense configuration
" TODO: split up config into multiple files
" source $HOME/.config/nvim/vim-plug/plugins.vim
" source $HOME/.config/nvim/<category>/<sub-category-filename>.vim
" source $HOME/.config/nvim/<plug-config>/<plugin-name>.vim
set nocompatible
filetype off
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
@rajinwonderland
rajinwonderland / memorySizeOf.js
Created March 4, 2020 01:06
Calculate Memory Size of a JS Object
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if (obj !== null && obj !== undefined) {
switch (typeof obj) {
case "number":
bytes += 8;
break;
case "string":
@janwirth
janwirth / dsgvo.md
Last active May 24, 2018 09:52
DSGVO

Musterdatenschutzerklärung für Websitebetreiber nach den Vorgaben der DSGVO

Erläuterung zur Musterdatenschutzerklärung

Die folgende Musterdatenschutzerklärung ist als Grundgerüst für eine der EU-Datenschutzgrundverordnung (DSGVO) konforme Datenschutzerklärung für Websitebetreiber zu verstehen. Die Erklärung ist nicht abschließend und umfasst nicht alle erforderlichen Elemente. Zudem können in der

@uraimo
uraimo / dnsovertls.md
Last active May 27, 2024 18:17
Configure your Mac to use DNS over TLS
@ljharb
ljharb / array_iteration_thoughts.md
Last active October 24, 2024 07:30
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@paulirish
paulirish / bling.js
Last active November 4, 2024 17:48
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active November 2, 2024 12:19
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {