Skip to content

Instantly share code, notes, and snippets.

@aFarkas
aFarkas / focus-within.js
Last active August 20, 2020 10:49
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;
@kimmobrunfeldt
kimmobrunfeldt / 0-osx-for-web-development.md
Last active July 26, 2022 13:30
Install web development tools to Mavericks (OS X 10.9)

Install web development tools to Mavericks (OS X 10.9)

Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.

I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).

These are my opinions. Read this document through and pick up the good parts to your preferences.

System preferences

@nuxodin
nuxodin / focusin focusout support for firefox.js
Last active February 7, 2024 16:40
focusin focusout support for firefox
/* Copyright (c) 2016 Tobias Buschor https://goo.gl/gl0mbf | MIT License https://goo.gl/HgajeK */
/* focusin/out event polyfill (firefox) */
!function(){
var w = window,
d = w.document;
if (w.onfocusin === undefined) {
d.addEventListener('focus' ,addPolyfill ,true);
d.addEventListener('blur' ,addPolyfill ,true);
d.addEventListener('focusin' ,removePolyfill ,true);
@DivineDominion
DivineDominion / markdownTemplate.txt
Last active June 4, 2023 06:56
BibDesk MultiMarkdown export template. Put into `~/Library/Application Support/BibDesk/Templates` and activate in settings to use.--- From http://zettelkasten.de/bibliography-zettelkasten/
<$publications>
[#<$citeKey/>]: <$authors.name?>
<$authors.name.stringByRemovingTeX.@componentsJoinedByCommaAndAnd/><?$authors.name?><$editors.name.stringByRemovingTeX.@componentsJoinedByCommaAndAnd/> (Hrsg.)
</$authors.name?>
<$fields.Year?> (<$fields.Year/>)</$fields.Year?>: _<$fields.Title.stringByRemovingTeX/><$fields.Subtitle?>. <$fields.Subtitle.stringByRemovingTeX/></$fields.Subtitle?>_<$pubType=article?>
, <$fields.Journal/><$fields.Number?> <$fields.Number/></$fields.Number?>, <$fields.Year/>, Vol. <$fields.Volume/>, S. <$fields.Pages/><?$pubType=incollection?>
, in: <$fields.Booktitle/><$fields.Address?>, <$fields.Address/>: <$fields.Publisher?><$fields.Publisher/></$fields.Publisher?><?$fields.Address?>
<$fields.Publisher?>, <$fields.Publisher/></$fields.Publisher?>
</$fields.Address?>
<?$pubType?>
@jsebrech
jsebrech / accessors.php
Created September 28, 2013 08:45
Demo of something like C# accessors in PHP using meta-programming
<?php
// requires PHP 5.4
trait ClassAccessors {
public function __set($name, $value) {
$methodName = "set".ucfirst($name);
if (method_exists($this, $methodName)) {
$this->$methodName($value);
} else {
@konklone
konklone / ssl.rules
Last active May 17, 2024 04:23
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@AlekseyKorzun
AlekseyKorzun / gist:6099219
Last active February 2, 2021 11:23
Pre-commit hook that supports PHPCS and PHPDOC
#!/bin/bash
################################################################
# Pre commit hook for git
#
# @package: utilities
# @subpackage: utilities\git
# @author: Aleksey Korzun <al.ko@webfoundation.net>
################################################################
@jpetazzo
jpetazzo / README.md
Last active August 21, 2019 17:55
Give network superpowers to docker

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Note: I recommend to use https://github.com/jpetazzo/pipework instead.

  • pipework is a better name than unionize
  • it's hosted on a "real" github repo instead of a small gist :-)

Now if you want Unionize, it's still here. Just check those examples.

@abteilung
abteilung / TYPO3-reduce-CSS-Classes
Created April 7, 2013 15:42
TYPO3-CSS-Klassen entfernen aufräumen. Kein class="bodyTag" oder class="csc-firstHeader".
lib {
parseFunc_RTE {
nonTypoTagStdWrap.encapsLines {
### entfernt "class=bodytext" aus p-Tags
addAttributes.P.class =
}
}
stdheader {
### entfernt div-Tag um Headlines
stdWrap.dataWrap = |