Skip to content

Instantly share code, notes, and snippets.

@damonkelley
damonkelley / .vimrc
Created October 11, 2019 19:41
Fuzzy Finding
" Plugins {{{
call plug#begin()
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
call plug#end()
"}}}
" Search for word under the cursor
nnoremap <silent> <leader>* :Rg! <C-R><C-W><CR>
nnoremap <leader>/ :Rg!
@damonkelley
damonkelley / parameterized_test.exs
Created May 13, 2019 23:19
Parameterized Tests in Elixir
defmodule ParamerizedTest do
use ExUnit.Case
@parameters [
{0, 0},
{1, 1},
{2, 4},
{3, 9},
]
@damonkelley
damonkelley / docker-compose.yml
Created February 6, 2018 16:42
Docker Compose in dind
version: "3"
services:
compose:
image: docker/compose:1.18.0
volumes:
- ./:/app
command: -H tcp://docker:2375 -f /app/docker-compose.test.yml up
links:
- dind:docker
@damonkelley
damonkelley / change_maker.ex
Last active May 23, 2017 03:19
Change Maker in Elixir - with and without a macro
defmodule ChangeMaker do
@coins [50, 25, 10, 5, 1]
def change(n) do
@coins
|> Enum.zip([0, 0, 0, 0, 0])
|> Enum.into(%{})
|> change(n)
end
@damonkelley
damonkelley / Pipeline.java
Last active May 21, 2017 18:46
Java Pipeline Class
public class Pipeline<T> {
private final T value;
public Pipeline(T value) {
this.value = value;
}
public static <T> Pipeline<T> with(T value) {
return new Pipeline<T>(value);
}

Keybase proof

I hereby claim:

  • I am damonkelley on github.
  • I am damonkelley (https://keybase.io/damonkelley) on keybase.
  • I have a public key ASCA0GEpmSYI7DSeQvtxDpXClWY8TfI2TxxC1fKEWzDzrAo

To claim this, I am signing this object:

@damonkelley
damonkelley / GIF-Screencast-OSX.md
Created May 13, 2016 16:17 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@damonkelley
damonkelley / complete.sh
Last active September 10, 2015 14:43 — forked from pcreux/complete.sh
Github Commit Status API with Bamboo from Atlassian. Add those to your plan as Script.
# specs and cukes results are stored in JUnit format under test-reports
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
fi
import logging
from rest_framework import serializers
class GeneralModelSerializer(serializers.ModelSerializer):
""" General model serializer that will serialize a model object. It will return all the model fields.
"""
class Meta:
model = None