Skip to content

Instantly share code, notes, and snippets.

@npostulart
npostulart / how-to-set-up-stress-free-ssl-on-os-x.md
Created July 17, 2019 18:34 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
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

@npostulart
npostulart / TwoPointHeading.php
Created November 18, 2018 19:39
Get heading from two lat/lng points
<?php
function computeHeading($from, $to) {
$fromLat = deg2rad($from['lat']);
$fromLng = deg2rad($from['lng']);
$toLat = deg2rad($to['lat']);
$toLng = deg2rad($to['lng']);
$dLng = $toLng - $fromLng;
$heading = rad2deg(
@npostulart
npostulart / README.md
Last active August 19, 2018 21:52
Simple Feature Detection Library

Simple Feature Detection Library to check JS, SVG and Touch support. Replaces no-js class on html element with js, adds no-svg if no support for SVG and touch or no-touch depending on the used device.

@npostulart
npostulart / convert-function.scss
Last active July 18, 2022 14:21
Unit Converting Sass Function
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$baseSize: 16px;
$convertBase: $baseSize;
html {
font-size: percentage($baseSize / 16px);
@npostulart
npostulart / rem-attributes.scss
Last active November 7, 2017 20:08
REM Mixin for CSS Attributes
// ----
// Sass (v3.3.14)
// ----
@function parseInt($n) {
@return $n / ($n * 0 + 1);
}
@mixin rem($property, $values) {
$px : ();
@npostulart
npostulart / simple_breakpoint.scss
Last active November 7, 2017 20:06
Simple Breakpoints Mixin
/// Simple Breakpoint Mixin
///
/// Takes list of arguments to define media queries
///
/// @author Niklas Postulart
/// @group layout
/// @param {Lists} $lists - Lists of queries
/// @example
/// .example {
/// @include breakpoint(min 100px, max 30rem) {