Skip to content

Instantly share code, notes, and snippets.

@alixaxel
alixaxel / Makefile
Created February 10, 2016 16:29
Golang Makefile
.PHONY: build doc fmt lint run test vendor_clean vendor_get vendor_update vet
# Prepend our _vendor directory to the system GOPATH
# so that import path resolution will prioritize
# our third party snapshots.
GOPATH := ${PWD}/_vendor:${GOPATH}
export GOPATH
default: build
@alixaxel
alixaxel / pagination.md
Created February 2, 2016 11:13 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@alixaxel
alixaxel / flatMap.php
Created January 23, 2016 16:16 — forked from italolelis/flatMap.php
FlatMap implementation in PHP, following the Reactive Extensions intiative
function flatMap($data, \Closure $p)
{
$collection = call_user_func_array("array_map", array($p));
return iterator_to_array(new \RecursiveIteratorIterator(
new \RecursiveArrayIterator($data)), false);
}
BM25.Tokenize = function(text) {
text = text
.toLowerCase()
.replace(/\W/g, ' ')
.replace(/\s+/g, ' ')
.trim()
.split(' ')
.map(function(a) { return stemmer(a); });
// Filter out stopStems
@alixaxel
alixaxel / fortune.fish
Created October 30, 2015 21:42 — forked from montanaflynn/fortune.fish
Fun with fish and fortunes
# place this in your fish path
# ~/.config/fish/config.fish
function fish_greeting
if not type fortune > /dev/null 2>&1
apt-get install fortune
end
fortune -a
end

Easy handle interface

Options

Info

  1. General Background and Overview
\b
(?:
https?://
(?:[^.]+[.])?
)?
(?:
amazon[.][^/]+/
(?:
(?:[^/]+/)?dp/
|

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

@alixaxel
alixaxel / damm.php
Last active August 29, 2015 14:04
Damm Algorithm
<?php
function Damm($string, $encode = true)
{
if ($encode > 0)
{
$encode += 1;
$string = str_split($string, 1);
$matrix = array_chunk(str_split('0317598642709215486342068713591750983426612304597836742095815869720134894536201794386172052581436790', 1), 10);