Skip to content

Instantly share code, notes, and snippets.

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@patio11
patio11 / ansible-snippet.yaml
Created July 9, 2015 02:44
Create an account on every box using the list of employees; initialize with their Github SSH keys
vars:
starfighters:
- username: patrick
github: patio11
name: "Patrick McKenzie"
- username: thomas
github: tqbf
name: "Thomas Ptacek"
- username: erin
github: boboTjones
@paulirish
paulirish / bling.js
Last active April 20, 2024 17:39
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active May 23, 2022 12:28
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
div.description a.autolink
{
display: inline-block;
max-width: 250px;
text-overflow: ellipsis;
overflow: hidden;
}
@ziadoz
ziadoz / CapsuleServiceProvider.php
Last active May 1, 2020 02:46
Laravel Eloquent/Capsule Silex Service Provicer
<?php
use Silex\Application;
use Silex\ServiceProviderInterface;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
use Illuminate\Cache\CacheManager;
class CapsuleServiceProvider implements ServiceProviderInterface
{
@igorw
igorw / php-lazy-seq.php
Last active August 23, 2021 16:47
Lazy sequences using PHP 5.5 generators.
<?php
// thanks to metaultralurker on reddit for inspiration
function map(callable $fn, \Traversable $data) {
foreach ($data as $v) {
yield $fn($v);
}
}
@igorw
igorw / gist:5894929
Created June 30, 2013 12:11
Conditional Strategy Stack Middleware.
<?php
class Conditional implements HttpKernelInterface {
private $app;
private $prefix;
private $wrappedApp;
public function __construct(HttpKernelInterface $app, $prefix, $spec) {
$this->app = $app;
$this->prefix = $prefix;

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@sstephenson
sstephenson / Simple Encryption.md
Created April 11, 2013 23:48
Simple file/stream encryption using OpenSSL

Simple file/stream encryption using OpenSSL

Create and store a 512-byte random encryption key named secret:

$ mkkey secret

Encrypt the contents of file with the secret key and write it to file.enc:

$ encrypt secret < file > file.enc