Skip to content

Instantly share code, notes, and snippets.

@tooky
tooky / bumbailiff
Created Sep 18, 2017
Bumbailiff - A script for ageing TODO comments in code.
View bumbailiff
#!/usr/bin/env bash
#
# The bumbailiff allows the team to take up a small amount of technical debt
# (TODOs in the code) for a limited period. After that period the script fails.
#
# It will find // TODO in .js or .jsx files, and # TODO in .feature files.
#
# For example, if the allowed period for all the TODOs is 14 days.
# * It's OK to have 1 TODO that is 13 days old
# * It's OK to have 3 TODOs that are 4 days old
View protection_proxy.rb
require 'delegate'
class ProtectionProxy < SimpleDelegator
def initialize(object, *writable_fields)
super(object)
@writable_fields = writable_fields
end
def method_missing(method, *args, &block)
method_name = method.to_s
if !method_name.end_with?('=')
@tooky
tooky / Rakefile
Created Jun 28, 2013
A simple way to manage a Jekyll static site that uses plugins
View Rakefile
require 'heavies_publish'
require 'launchy'
desc 'Publish the site'
task :publish => 'publish:publish'
namespace :publish do
include Heavies::Publish
directory Heavies::Publish.dir
@tooky
tooky / property.feature
Last active Apr 19, 2018
gherkin <3 properties
View property.feature
Feature: Calculate order total
Rule: discounts are applied for eligible, registered users
Given the registered customer
| email | <email> |
| eligible for discount | <eligible> |
| discount | <discount> |
When there is an order by <order-email> for <amount>
Then the order total should be <total>
@tooky
tooky / .mobbers
Last active Mar 22, 2018
prepare-commit-msg hook to include potention Co-authors
View .mobbers
Co-authored-by: Joanne Bloggs <jo@example.com>
Co-authored-by: John Dowe <123456+JohnDowe@users.noereply.github.com>
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
View ShoutyExtension.php
<?php
use Shouty\Shouty;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Behat\Testwork\ServiceContainer\ExtensionManager;
use Behat\Testwork\ServiceContainer\Extension;
use Behat\Behat\Context\ServiceContainer\ContextExtension;
use Behat\Behat\Context\Initializer\ContextInitializer;
use Behat\Behat\Context\Context;
View safe_promise_fiddling.js
it('can be returned like a promise', () => {
let expectedError = new Error('I am not good.');
let SafePromise = safePromises.failWith(actualError => {
expect(actualError).to.equal(expectedError);
});
return SafePromise.reject(expectedError)
.then(() => { throw new Error('should be caught') })
.catch()
})
View spec_spec.rb
describe 'stuff' do
[1,2,3,4].each do |n|
it n do
expect(n).to be < 5
end
end
end
View sum.feature
Feature: Summing numbers
In order to understand the gherkin syntax
As someone new to cucumber
I want a simple example
Scenario: Summing two positive numbers
Given the first number is 1
And the second number is 2
When I sum the numbers
Then the answer is 3