Skip to content

Instantly share code, notes, and snippets.

View silentworks's full-sized avatar

Andrew Smith silentworks

View GitHub Profile
@silentworks
silentworks / how-to-set-up-stress-free-ssl-on-os-x.md
Created February 28, 2018 13:37 — 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

@silentworks
silentworks / remove-docker-containers.md
Created September 8, 2017 09:54 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@silentworks
silentworks / App.html
Created September 5, 2017 15:26 — forked from anonymous/App.html
Svelte component
<label>
<input type='checkbox' bind:checked='visible'> visible
</label>
{{#if visible}}
<div transition:scale></div>
{{/if}}
<style>
div {
@silentworks
silentworks / App.html
Created September 5, 2017 15:25 — forked from anonymous/App.html
Svelte component
<Modal bind:showModal title="Hello World" content="How are you man, this is something that isn't coming along." />
<a href="#" on:click="set({showModal: true})">Modal Open</a>
<script>
import Modal from './Modal.html';
export default {
data: function () {
return {
@silentworks
silentworks / App.html
Created September 5, 2017 15:24 — forked from anonymous/App.html
Svelte component
<label>
<input type='checkbox' bind:checked='visible'> visible
</label>
{{#if visible}}
<div in:fade="{ duration: 300 }" out:fly="{ duration: 300, delay: 300, y: -80 }">
<div class="inner" transition:scale="{ duration: 600 }"></div>
</div>
{{/if}}
@silentworks
silentworks / README.md
Created August 2, 2017 17:51 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@silentworks
silentworks / App.html
Last active August 25, 2020 08:05 — forked from anonymous/App.html
Svelte Filter List component
<div class="filtering-list">
<div class="filter-search">
<input bind:value="q" type="text" class="search">
</div>
<ul class="filter-list">
{{#each filteredList as name}}
<li>#{{name}}</li>
{{/each}}
</ul>
@silentworks
silentworks / neo_create_block.php
Created July 31, 2017 17:49 — forked from benjamminf/neo_create_block.php
Create Neo block and save it to entry
<?php
// Get the entry model. This could really be any element model, such as a category or Craft Commerce product.
$entry = craft()->entries->getEntryById(1234);
// Get the Neo field model and the field type model.
$field = craft()->fields->getFieldByHandle('neoFieldHandle');
$fieldType = $field->getFieldType();
$fieldType->setElement($entry);
@silentworks
silentworks / App.html
Created July 10, 2017 20:27 — forked from anonymous/App.html
Svelte component
<h1 class="text-center">Example</h1>
<div class="list">
{{#each results as result @id}}
<Card result={{result}} />
{{/each}}
</div>
<script>
import Card from './Card.html';
@silentworks
silentworks / App.html
Last active July 8, 2017 10:06 — forked from anonymous/App.html
Svelte component
<div class='foo'>
Big red Comic Sans
</div>
<style>
.foo {
color: blue;
font-size: 2em;
font-family: 'Comic Sans MS';
}