Skip to content

Instantly share code, notes, and snippets.

View DevDavido's full-sized avatar

David B. DevDavido

  • Berlin, Germany
View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@eligrey
eligrey / insertAdjacentHTML.js
Created October 10, 2011 18:06
insertAdjacentHTML polyfill
/*
* insertAdjacentHTML.js
* Cross-browser full HTMLElement.insertAdjacentHTML implementation.
*
* 2011-10-10
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@millermedeiros
millermedeiros / osx_setup.md
Last active June 26, 2024 22:08
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@vasanthk
vasanthk / System Design.md
Last active July 25, 2024 17:47
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@KostyaEsmukov
KostyaEsmukov / _nginx_docker_config.md
Last active July 14, 2024 04:52
Nginx configuration sample for docker

Nginx production configuration sample

This config assumes that nginx is run from docker image _/nginx.

docker commands

docker network create nginx

mkdir -p /etc/myproject/nginx

cd /etc/myproject/nginx

@brunogaspar
brunogaspar / macro.md
Last active July 12, 2024 12:08
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 26, 2024 08:00
set -e, -u, -o, -x pipefail explanation
@J05HI
J05HI / eBay_Kleinanzeigen_Anzeige_duplizieren.js
Last active May 28, 2024 20:20
Add "reinstate" functionality, refactoring
// ==UserScript==
// @name eBay Kleinanzeigen - Anzeige duplizieren / neu einstellen
// @namespace https://github.com/J05HI
// @description Bietet eine "Anzeige duplizieren / neu einstellen" Funktion beim Bearbeiten einer vorhandenen Anzeige in eBay Kleinanzeigen.
// @icon http://www.google.com/s2/favicons?domain=www.kleinanzeigen.de
// @copyright 2024, J05HI (https://github.com/J05HI)
// @license MIT
// @version 1.4.0
// @match https://www.kleinanzeigen.de/p-anzeige-bearbeiten.html*
// @grant none