Skip to content

Instantly share code, notes, and snippets.

View laukstein's full-sized avatar
🏠
Working from home

Binyamin Laukstein laukstein

🏠
Working from home
View GitHub Profile
@alyleite
alyleite / wsl.md
Last active April 15, 2024 06:34
Failed to connect to bus: Host is down - WSL 2

» sudo systemctl daemon-reload

System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

==============================================

Edit*

  1. Open /etc/wsl.conf with any editor:
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@Salakar
Salakar / deepMerge.md
Last active November 22, 2023 09:02
ES6/ES2015 Object deep merge

Deep Merge

Quick function to deep merge using Object.assign(). Thoughts?

    /**
     * Simple is object check.
     * @param item
     * @returns {boolean}
     */
@azu
azu / Medium: remove location hash.user.js
Created December 2, 2015 15:05
Medium: remove location hash
// ==UserScript==
// @name Medium: remove location hash
// @namespace http://efcl.info/
// @description Remove location hash from medium
// @include https://medium.com/*#*
// @version 1
// @grant none
// ==/UserScript==
function removeLocationHash(){
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@khal3d
khal3d / is_rtl.php
Last active September 15, 2022 03:26
Check if there RTL characters (Arabic, Persian, Hebrew)
<?php
/**
* Is RTL
* Check if there RTL characters (Arabic, Persian, Hebrew)
*
* @author Khaled Attia <sourcecode@khal3d.com>
* @param String $string
* @return bool
*/
@Rob-ot
Rob-ot / prefixedCalc.js
Created August 20, 2012 01:23
Detect which prefixed css calc to use via javascript
// public domain, use it for whatever
// returns "calc", "-moz-calc", etc
// (no -ms because they already support it non-prefixed)
function prefixedCalc () {
var prefixes = ["","-webkit-","-moz-","-o-"], el
for (var i = 0; i < prefixes.length; i++) {
el = document.createElement('div')
el.style.cssText = "width:" + prefixes[i] + "calc(9px)"
if (el.style.length) return prefixes[i] + "calc"
@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@luk-
luk- / http_build_query.js
Created May 17, 2012 22:42
php's http_build_query() in javascript
var build_query = function (obj, num_prefix, temp_key) {
var output_string = []
Object.keys(obj).forEach(function (val) {
var key = val;
num_prefix && !isNaN(key) ? key = num_prefix + key : ''