Skip to content

Instantly share code, notes, and snippets.

View andrewbredow's full-sized avatar
💭
DJ is not available to answer questions.

Andrew Bredow andrewbredow

💭
DJ is not available to answer questions.
View GitHub Profile
@rob-brown
rob-brown / mastermind.ex
Last active August 15, 2022 08:43
A Mastermind game implemented in Elixir.
defmodule Mastermind do
defstruct rounds: 10, choices: 6, answer: nil, guesses: []
def start, do: game_loop %Mastermind{}
defp game_loop(game = %Mastermind{answer: nil}) do
game
|> start_computer_mastermind
|> game_loop
@knewter
knewter / roles_elixir_tasks_main.yml
Created August 18, 2014 14:23
elixir ansible deploy
---
- name: Create directory to put elixir in
sudo: 'yes'
shell: "mkdir -p /opt/elixir/v0.15.0"
- name: Install unzip
apt: name=unzip state=present update_cache=true
- name: Unzip elixir release
sudo: 'yes'
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

#!/bin/sh
#
# Usage: git semver-tags [-p|--pre]
#
# Lists semver tags in the repository in order from newest to oldest.
#
# Useful for e.g. programmatically finding the latest release tag:
# `git semver-tags | head -n 1`.
#
# Tag names must be valid according to the SemVer 1.0.0 specification
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@jimmynotjim
jimmynotjim / more-mute-regex.md
Created July 19, 2012 14:37 — forked from imathis/tweetbot-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@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
#
@nathansmith
nathansmith / data_icon.css
Created December 14, 2011 15:26
Terse Font Icons
a[data-icon]:before,
span[data-icon]:before {
font-family: 'Icon Font Here';
content: attr(data-icon);
}
/*
This would also work, but other web developers might
yell at you about "performance" which may/not matter:
@trshafer
trshafer / unmerged.sh
Created January 29, 2011 22:11
Open all conflicted files in textmate
# http://optimisdev.com/posts/open-all-conflicted-files-in-textmate
git ls-files --unmerged | awk '{print $4}' | sort -u | xargs mate