Skip to content

Instantly share code, notes, and snippets.

View nilz3ro's full-sized avatar
🧃

nil nilz3ro

🧃
View GitHub Profile
@nilz3ro
nilz3ro / commit_commenter.rb
Last active June 5, 2017 19:20
Add the latest commit hash to a given file, as an html comment.
require 'fileutils'
class CommitCommenter
def initialize(git_project_path)
@project_path = git_project_path.chomp
end
def latest_commit_hash
FileUtils.cd(@project_path)
return `git rev-parse HEAD`.chomp
@nilz3ro
nilz3ro / .tmux.conf
Created August 31, 2016 17:48
Tmux Conf
set -g default-terminal "screen-256color"
set -s escape-time 0
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -g mouse on
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
@nilz3ro
nilz3ro / langs.txt
Last active February 8, 2017 14:20
Hello, Worlds.
c
c#
c++
clojure
common lisp
crystal
dart
elixir
erlang
eve
@nilz3ro
nilz3ro / agile.md
Created October 10, 2016 16:56
Agile / Scrum As presented as Roger H.

Agile (As presented by Roger H.)

We should always be delivering The Thing that has the most Business Value.

Terms

Agile

The ability to create and respond to change in order to succeed in an uncertain and turbulent environment.

Scrum

@nilz3ro
nilz3ro / guard.md
Last active November 21, 2016 16:34
Intro to guard clauses.

Guard Clause

What is it?

A guard clause is a line of code that prevents the following block of code from running unless a certain condition is met.

Why use guard clauses?

Guard clauses are preferrable to nested conditionals because they are faster and simpler than nesting conditional statements.

@nilz3ro
nilz3ro / map.purs
Created November 22, 2016 17:51
PureScript's Infix Operator Aliases are aaaaawwwwweeeeessssooooooooommmmmmeeeeeeee.
(\n -> n * n) <$> [1, 2, 3, 4, 5]
@nilz3ro
nilz3ro / string-reverse.js
Created February 15, 2017 15:27
Recursion Example
// One liner.
const reverseIt = (string, memo='') => string.length ? reverseIt(string.substr(1), string.substr(0,1) + memo) : memo
// same as:
function reverseIt2 (string, memo='') {
if (string.length) {
return reverseIt2(string.substr(1), string.substr(0,1) + memo);
} else {
return memo;
@nilz3ro
nilz3ro / init.vim
Last active August 21, 2017 15:05
(n)Vim Configuration
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-sensible'
Plug 'scrooloose/nerdtree'
call plug#end()

Keybase proof

I hereby claim:

  • I am nilz3ro on github.
  • I am nilz3ro (https://keybase.io/nilz3ro) on keybase.
  • I have a public key ASCVf434N2WZYWMe6-LVI79LBo6zu5LjyajFOnuSYiwLdAo

To claim this, I am signing this object:

@nilz3ro
nilz3ro / darken-by-percentage.js
Last active November 8, 2017 16:52
Darken Hex Colors by percentage as a JS one-liner 😎
import { chunk } from 'lodash';
const darkenByPercentage = (hexString, percent) =>
chunk(hexString.substr(1).split(''), 2)
.reduce((memo, pair) => [...memo, `0x${pair.join('')}`], '')
.map(Number)
.map(digit => digit - Math.ceil(digit * (percent / 100)))
.reduce((memo, digit) => `${memo}${digit.toString(16)}`, '#');
// darkenByPercentage('#ffffff', 20);