Skip to content

Instantly share code, notes, and snippets.

@dvf
dvf / change-codec.md
Last active November 14, 2024 08:27
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@iffy
iffy / .gitignore
Last active August 15, 2024 09:27
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@noah
noah / common-exif-tags.csv
Created January 4, 2017 16:18
Common EXIF tags
ExifTool:ExifToolVersion 123469
File:Directory 123469
File:FileAccessDate 123469
File:FileInodeChangeDate 123469
File:FileModifyDate 123469
File:FileName 123469
File:FilePermissions 123469
File:FileSize 123469
SourceFile 123469
File:FileType 80230
@timoxley
timoxley / 1.rreaddir.js
Last active August 6, 2023 17:13
async/await recursive fs readdir
import { join } from 'path'
import { readdir, stat } from 'fs-promise'
async function rreaddir (dir, allFiles = []) {
const files = (await readdir(dir)).map(f => join(dir, f))
allFiles.push(...files)
await Promise.all(files.map(async f => (
(await stat(f)).isDirectory() && rreaddir(f, allFiles)
)))
return allFiles
@john-doherty
john-doherty / javascript-trim-svg-whitespace.js
Created October 21, 2016 13:39
Trim whitespace from SVG elements
function trimSvgWhitespace() {
// get all SVG objects in the DOM
var svgs = document.getElementsByTagName("svg");
// go through each one and add a viewbox that ensures all children are visible
for (var i=0, l=svgs.length; i<l; i++) {
var svg = svgs[i],
box = svg.getBBox(), // <- get the visual boundary required to view all children
@scottmagdalein
scottmagdalein / clickable-element.html
Last active March 15, 2023 18:01
Make the Mailchimp Subscriber popup appear on click
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
@techfort
techfort / electroloki
Created May 1, 2015 12:38
basic loading of LokiJS in an electron app
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var loki = require('lokijs'),
db = new loki(),
users = db.addCollection('users', {
indices: ['username']
});
users.insert({ username: 'joe', age: 40});
users.insert({ username: 'jack', age: 30});
@mandiwise
mandiwise / Update remote repo
Last active October 23, 2024 07:20
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@techfort
techfort / LokiSaveReload.js
Last active February 5, 2024 10:27
LokiJS - save to disk and reload
var loki = require('lokijs'),
db = new loki('test.json'),
db2 = new loki('test.json');
var users = db.addCollection('users');
users.insert({
name: 'joe'
});
users.insert({
name: 'john'
@RobK
RobK / serial.js
Last active June 28, 2022 02:54
Generate Random Serial Keys
/**
* Created by Robert Kehoe on 09/06/2014.
* MIT Licensed.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to