Skip to content

Instantly share code, notes, and snippets.

View devinrhode2's full-sized avatar
😀

Devin Rhode devinrhode2

😀
View GitHub Profile
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

@alexis89x
alexis89x / broadcast-channel-es6.js
Last active February 21, 2024 16:56
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 0.0.6
*/
/*
@adbutterfield
adbutterfield / prettier.config.js
Last active February 21, 2024 05:17
Default prettier config with comments and links to prettier rules
module.exports = {
/**
* Print Width
* https://prettier.io/docs/en/options.html#print-width
*
* Specify the line length that the printer will wrap on.
*
* printWidth: <int>
* default: 80
*/
@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active January 24, 2024 00:30
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@1951FDG
1951FDG / asuswrt-merlin.md
Last active November 10, 2023 17:28
Instructions for installing and configuring Squid caching proxy server on Asuswrt-Merlin

Setup Entware on Asuswrt-merlin

Entware is a modern alternative to Optware.

For those unfamiliar with Optware: it's a software repository that offers various software programs that can be installed on your router. They allow you to add new functionality to your router (provided you have the know-how to properly configure them).

Entware system library is specially modified (patched) so that standard linux files that are normally located in /etc directory are now located in /opt/etc/ directory. To simplify things let's consider /etc/passwd file. On Asuswrt-merlin it normally looks something like:

admin:x:0:0:admin:/root:/bin/sh

nas:x:100:100:nas:/dev/null:/dev/null

@devinrhode2
devinrhode2 / TraceKitSupplement.js
Last active October 23, 2023 12:49
Stuff I've added to my error reporting/handling stuff in addition to TraceKit.js, ideally in a few months I don't write any of this code
function exceptionalException(message) {
'use strict';
if (exceptionalException.emailErrors !== false) {
exceptionalException.emailErrors = confirm('We had an error reporting an error! Please email us so we can fix it?');
}
}
//test
//exceptionalException('try 1!');
//exceptionalException('try 2!');
@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@dgraham
dgraham / fetch.js
Last active March 24, 2023 15:44
Simple window.fetch wrapper.
(function() {
function status(response) {
if (response.ok) {
return response
} else {
var error = new Error(response.statusText || response.status)
error.response = response
throw error
}
}
@aaugustin
aaugustin / question.md
Last active January 4, 2023 05:04
Accessibility in browsers: zoom level vs. font size

Scroll to the bottom for the answer

Question

There's two ways to increase the default font size in browsers:

  1. set a default zoom level > 100% ("page zooming")
  2. set a default font size > 16px ("text scaling")

Option 1 relies on the browser's proportional scaling. This feature was

@belohlavek
belohlavek / binaryUtil.js
Last active January 3, 2023 16:37
ASCII to Binary and Binary to ASCII Utility functions in Javascript.
var Util = {
toBinary: function(input) {
var result = "";
for (var i = 0; i < input.length; i++) {
var bin = input[i].charCodeAt().toString(2);
result += Array(8 - bin.length + 1).join("0") + bin;
}
return result;
},