Skip to content

Instantly share code, notes, and snippets.

View mike182uk's full-sized avatar

Michael Barrett mike182uk

View GitHub Profile
@mike182uk
mike182uk / Makefile
Created September 9, 2019 11:29
Self documenting makefile
.PHONY: test
test: ## Run the tests
# TODO
.PHONY: lint
lint: ## Lint the soruce files
# TODO
.PHONY: build
build: ## Build the project
@mike182uk
mike182uk / primes.go
Created December 5, 2016 21:33
Generate prime numbers up to a certain value using the Sieve of Eratosthenes
func generatePrimesUntil(x int) []int {
t := []bool{false, true}
var p []int
for i := 3; i <= x; i++ {
t = append(t, true)
}
for i := 2; i < x; i++ {
if t[i] == true {
@mike182uk
mike182uk / gridserver.rake
Created July 12, 2014 16:09
Capistrano tasks for use with Mediatemple's Gridserver
namespace :gridserver do
desc "Set the document root to be the 'current' symlink instead of the HTML directory"
task :set_document_root do
on roles(:app) do
document_root_path = "#{deploy_to}/html"
if test "[ -d #{document_root_path} ]"
info "Removing old document root symlink"
execute :rm, "#{document_root_path}"
end
@mike182uk
mike182uk / commit-msg
Created May 2, 2014 19:52
commit-msg git hook (php)
#!/usr/bin/env php
<?php
/**
* =======================================================================================
* Change constants below to match how you want the hook to work
* =======================================================================================
*/
define('ENABLE_FIRST_LINE_LENGTH_CHECK', 1);