Skip to content

Instantly share code, notes, and snippets.

View silentworks's full-sized avatar

Andrew Smith silentworks

View GitHub Profile
@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 \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /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 / CreateUsersTable.php
Created July 10, 2017 23:58
Using PHPmig migrations with Eloquent schema builder
<?php
use Phpmig\Migration\Migration;
class CreateUsersTable extends Migration
{
protected $tableName;
/* @var \Illuminate\Database\Schema\Builder $schema */
protected $schema;
@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';
}
@silentworks
silentworks / gist:240845b8a204a3ff5cf135157c59209f
Created May 24, 2017 09:26 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
<?php
$app = new Slim\App();
$app->group(new ApiRoutes);
// ApiRoutes
class ApiRoutes
{
<?php
$app = new Zend\Stratigility\MiddlewarePipe();
// Direct instantiation, with a callback handler, request, and response
$server = Zend\Diactoros\Server::createServer($app, $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
$app->pipe('/hello', function ($req, $res, $next) {
return $res->getBody()->write('Hello World!');
});
$app->pipe(function (Psr\Http\Message\RequestInterface $req, Psr\Http\Message\ResponseInterface $res, $next) {
@silentworks
silentworks / Auth.js
Created March 14, 2017 20:45 — forked from weyert/Auth.js
Trails annotations
const Annotation = require('ecmas-annotations').Annotation
const _ = require('lodash')
/**
* @module Auth
* @description Auth annotation
*/
module.exports = class Auth extends Annotation {
constructor(data, filePath) {