Skip to content

Instantly share code, notes, and snippets.

View ellimist's full-sized avatar

Adrian Bordinc ellimist

View GitHub Profile
@phil-blain
phil-blain / .gitattributes
Last active July 21, 2024 13:24
Git pickaxe : show only relevant hunks (filter displayed hunks using the given search string)
*.md diff=markdown
@kenji4569
kenji4569 / ulid_converter.sql
Last active June 3, 2024 06:02
ULID (26 characters in Crockford's base32) conversion for MySQL function
# Define ULID_DECODE and ULID_ENCODE which convert a ulid string to a binary and vice versa.
delimiter //
DROP FUNCTION IF EXISTS ULID_DECODE//
CREATE FUNCTION ULID_DECODE (s CHAR(26)) RETURNS BINARY(16) DETERMINISTIC
BEGIN
DECLARE s_base32 CHAR(26);
SET s_base32 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(UPPER(s), 'J', 'I'), 'K', 'J'), 'M', 'K'), 'N', 'L'), 'P', 'M'), 'Q', 'N'), 'R', 'O'), 'S', 'P'), 'T', 'Q'), 'V', 'R'), 'W', 'S'), 'X', 'T'), 'Y', 'U'), 'Z', 'V');
RETURN UNHEX(CONCAT(LPAD(CONV(SUBSTRING(s_base32, 1, 2), 32, 16), 2, '0'), LPAD(CONV(SUBSTRING(s_base32, 3, 12), 32, 16), 15, '0'), LPAD(CONV(SUBSTRING(s_base32, 15, 12), 32, 16), 15, '0')));
END//
@dmarquezbh
dmarquezbh / Vagrantfile
Last active October 22, 2016 15:57
Fancybox DAAS - Devbox As A Service
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'vagrant'
# Monkey patch VirtualBox provider to be able to remap shared folders after reboot.
module VagrantPlugins
module ProviderVirtualBox
module Action
class RemountSyncedFolders < SyncedFolders
@mikermcneil
mikermcneil / outcome-oriented-programming.md
Last active July 13, 2017 14:34
Outcome Oriented Programming - Software as a plan

Outcome-Oriented Programming

Mike McNeil, Aug 2014

Humans are not very good at planning. We have no problem running scenarios, thinking through possibilities, and pondering "what if?" questions. I might plan to not eat my cousin's birthday cake before she gets home, for instance. If I'm very serious, I might write down my commitment; or if I'm unsure about the pros and cons, use some organizational tool like a T-chart.

But when it comes to making a decision in the moment, all bets are off. The cake is a goner.

Predictive Analysis vs. Process Design

Below, I've included a figure containing a decision tree diagram.

@aras-p
aras-p / preprocessor_fun.h
Last active July 16, 2024 02:50
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rodrigoalvesvieira
rodrigoalvesvieira / concat-images.rb
Last active October 23, 2018 13:11
Concatenate multiple images into one using ImageMagick and Ruby
#!/usr/bin/env ruby
=begin
Rodrigo Alves
Februrary 26, 2013
A program to concatenate multiple images into one
Call it from the command line and pass it n parameters, the first n-1 parameters
are the names of the images from which you wanna create another image and the n-th
@andredublin
andredublin / Enlightenment.md
Last active December 10, 2015 04:48
Software development enlightenment that I have achieved over time.

#Testing

  • Isolate the object under test, don’t test multiple objects under one test case, this creates unneeded code and technical debt.
  • Unit test behavior, not methods. We need to know how to use the class to achieve a goal, not how to exercise all the paths through its code.
  • Don't test active record, it isn't a special behavior that the system is performing.
  • You don't need 100% test coverage all the time.
  • Don’t test query messages ( messages that do not modify another object ).
  • Do test command messages ( messages that do modify another object ).
  • Test the public interface of an object, private methods are always changing and add technical debt to the test and code.
  • Mock objects that are outside of the current object test scope (roles, interfaces, other objects)
@ryanfitz
ryanfitz / golang-nuts.go
Created December 2, 2012 22:45
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"