Skip to content

Instantly share code, notes, and snippets.

@shadowhand
shadowhand / CreateSpec.php
Created May 19, 2014 17:41
Testing for (in)valid input without concrete validation setup rules
<?php
namespace spec\Ushahidi\Usecase\Tag;
use Ushahidi\Tool\Validator;
use Ushahidi\Usecase\Tag\CreateTagRepository;
use PhpSpec\ObjectBehavior;
class CreateSpec extends ObjectBehavior
@shadowhand
shadowhand / oauth.feature
Created May 23, 2014 04:10
Failing Behat / Mink test
Given I am on "oauth/authorize?response_type=code&client_id=demoapp&state=testing&scope=api" with redirection
When I fill in "login-username" with "robbie"
And I fill in "login-password" with "testing"
And I press "login-submit"
@shadowhand
shadowhand / keybase.md
Created May 26, 2014 21:05
Proving myself on Keybase

Keybase proof

I hereby claim:

  • I am shadowhand on github.
  • I am shadowhand (https://keybase.io/shadowhand) on keybase.
  • I have a public key whose fingerprint is 85F6 D990 8372 0328 A701 014F 3DD9 1C13 077C 722E

To claim this, I am signing this object:

import json
import os
import requests
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
if GITHUB_TOKEN is None:
raise Exception('Missing GITHUB_TOKEN from os.environ')
@shadowhand
shadowhand / web.php
Last active August 29, 2015 14:04
Run phinx from the web
<?php
/* Phinx
*
* (The MIT license)
* Copyright (c) 2014 Rob Morgan
* Copyright (c) 2014 Woody Gilk <woody.gilk@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated * documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
@shadowhand
shadowhand / nginx-front-controller.conf
Created August 11, 2014 04:37
nginx configuration for using a single file as the front controller
server {
...
location / {
try_files $uri $uri/ @missing;
}
# Rewrite 404s back to PHP
#
location @missing {
rewrite ^ /index.php last;
}
# Starts server in current folder
tell application "Finder"
set currentDir to POSIX path of ((container of (path to me)) as text)
end tell
tell application "Terminal" to activate
tell application "Terminal"
do script ("cd '" & currentDir & "'")
@shadowhand
shadowhand / .vimrc
Created October 19, 2014 13:32
Disable arrow keys in vim
" stop using arrow keys!
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
@shadowhand
shadowhand / err.log
Created October 23, 2014 19:50
mariadb error 2006 "server has gone away" log
141023 14:47:57 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
To report this bug, see http://kb.askmonty.org/en/reporting-bugs
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
@shadowhand
shadowhand / wtf-controller.js
Last active August 29, 2015 14:11
Angular JS select
$scope.changedRole;
$scope.changeRole = function() {
if (confirm('Are you sure you want set the role of selected users to ' + $scope.changedRole + '?')) {
alert('TODO [ not implemented ]');
}
};
$scope.roles = [
{
name: 'guest',