Skip to content

Instantly share code, notes, and snippets.

@nidgetgod
nidgetgod / icu-install.sh
Last active June 27, 2024 07:40 — forked from siffash/icu-install.sh
Install ICU from source and build php-intl with the specific version of ICU
#!/usr/bin/env bash
if [[ -x $(which php) ]]; then
PHP_ICU_VERSION=$(php -r 'echo defined("INTL_ICU_VERSION") ? INTL_ICU_VERSION : "none";')
echo "PHP ICU version: $PHP_ICU_VERSION"
else
echo 'WARNING: PHP not installed'
PHP_ICU_VERSION=none
fi
@five-oclock-heroes
five-oclock-heroes / multidomain.ssl.txt
Last active November 22, 2023 06:42
Apache + SSL Multi-domain Configuration
# Description
Piecing together lots of information from different sources, this covers setup and configuration for:
1. Creating a self-signed, mulit-domain certificate for a development environment running OS X.
2. Generating a multi-domain certificate signing request (CSR) for staging/production environments running on CentOS 7.
3. Installing certificate and Apache configuration.
This assumes all environments are running OpenSSL v.0.9.8f or later and Apache 2 with Server Name Indication (SNI) support. SNI is the bit of magic that allows one certificate to be valid to use with Virtual Hosts with different domains on one server. See Apache configuration link in the Sources section below for more information and a much better explanation on how it all works.
# Development
@moneytoo
moneytoo / gist:ab3f34e4fddc2110675952f8280f49c5
Last active March 22, 2020 16:05
nginx with OpenSSL 1.0.2 (ALPN) on CentOS 7, also available from https://brouken.com/brouken-centos-7-repo/
### No longer needed as of nginx-1.13.6-1.el7_4.ngx.x86_64.rpm from nginx.org
### it was compiled against OpenSSL 1.0.2 from CentoOS 7.4 so it supports ALPN (HTTP2 works)
yum -y groupinstall 'Development Tools'
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel rpmdevtools
OPENSSL="openssl-1.0.2l"
NGINX_VERSION="1.13.5-1"
NJS_VERSION="1.13.5.0.1.13-1"
@NekR
NekR / standalone.md
Last active August 29, 2021 07:10
How to detect if app was run in standalone mode in Chromium (with manifest.json)

Hacky way to detect if app was launched in standalone mode in Chromium (with manifest.json) without problems with AppCache (and possibly ServiceWorker).

As suggested on one of the Google Developers sites, one may use search params in start_url of the manifest.json to notify page about that it was launched in standalone mode: start_url: '/?standalone'.

This works well unless your page uses AppCache (or ServiceWorker). In case of AppCache, every url with different search params is treated as separate entry in cache. So if you have listed / path in AppCache and naively used start_url: '/?standalone' in your manifest.json, then your Web App won't work offline from the Home Screen.
_With ServiceWorker, however, there is few ways to fix this directly in its code, like ignoreSearch option for match() method (currently not supported in Chromium) or just traversing cache entries manually and comparing new URL(event.request.url).pathname with stored request `new URL(...).path

@paulirish
paulirish / what-forces-layout.md
Last active July 22, 2024 06:32
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@nuxodin
nuxodin / webkit contenteditable focus bug workaround.html
Last active August 29, 2015 14:22
WebKit bug workaround: outside click of inline or floated contentEditable-elements focuses the element
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>WebKit bug workaround: outside click of inline or floated contentEditable-elements focuses the element</title>
<script>
if (/AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)) {
document.addEventListener('DOMContentLoaded', function(){
var fixEl = document.createElement('input');
fixEl.style.cssText = 'width:1px;height:1px;border:none;margin:0;padding:0; position:fixed; top:0; left:0';
fixEl.tabIndex = -1;
@MSEdge
MSEdge / IE-Edge-diff.idl
Last active January 29, 2022 23:18
Proprietary / Non-Inteoperable IE APIs no longer in Microsoft Edge
interface AesGcmEncryptResult {
readonly attribute ArrayBuffer ciphertext;
readonly attribute ArrayBuffer tag;
};
interface BookmarkCollection {
readonly attribute long length;
any item(unsigned long index);
@jankeromnes
jankeromnes / devices.js
Last active December 3, 2021 09:40
List of common devices and their properties
// This list of common devices was put together from various online sources by me, Jan Keromnes.
//
// The device features are:
// - name: The device brand and model(s).
// - width: The viewport width.
// - height: The viewport height.
// - pixelRatio: The screen's pixel ratio (e.g. HiDPI > 1).
// - userAgent: The device's UserAgent string on the web.
// - touch: Whether the device's screen is touch-enabled.
//
@WebReflection
WebReflection / html-escape.md
Last active August 21, 2022 16:27
How to escape and unescape from a language to another

update

I've created a little repository that simply exposes the final utility as npm module.

It's called html-escaper


there is basically one rule only: do not ever replace one char after another if you are transforming a string into another.

@rutger1140
rutger1140 / jail.local
Created October 2, 2014 13:48
Fail2Ban - block WordPress brute force hack attempts - Plesk 12
# Create a new jail via Plesk
# generated in /etc/fail2ban/jail.local
[wp-auth]
enabled = true
filter = wp-auth
action = iptables-multiport[name=NoAuthFailures, port="http,https"]
logpath = /var/www/vhosts/system/*/logs/*access*log
/var/log/httpd/*access_log
maxretry = 15