Skip to content

Instantly share code, notes, and snippets.

View danielberkompas's full-sized avatar

Daniel Berkompas danielberkompas

View GitHub Profile
@danielberkompas
danielberkompas / .gitconfig
Last active February 10, 2021 23:48
Git Cheat Sheet
# Use these aliases in your gitconfig for awesomeness
# You can use them like so:
# git lg -> prettier logs
# git s -> "git status"
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
s = status -s
@danielberkompas
danielberkompas / wait_for_ajax.rb
Created February 6, 2015 19:12
Race Conditions in Capybara
def wait_for_ajax
Timeout.timeout(Capybara.default_wait_time) do
loop until finished_all_ajax_requests?
end
end
def finished_all_ajax_requests?
page.evaluate_script("jQuery.active").zero?
end

Keybase proof

I hereby claim:

  • I am danielberkompas on github.
  • I am dberkom (https://keybase.io/dberkom) on keybase.
  • I have a public key whose fingerprint is 3231 92F3 2380 DF70 97E9 DB82 A53C DADD 426D 840C

To claim this, I am signing this object:

@danielberkompas
danielberkompas / gist:737b11e3c36e20b0ebe4
Created April 2, 2015 17:20
Generate ctags for YouCompleteMe
ctags -R --fields=+l
@danielberkompas
danielberkompas / .travis.yml
Created April 3, 2015 22:23
Build PLTs on Travis
language: elixir
elixir:
- 1.0.0
- 1.0.1
- 1.0.2
- 1.0.3
otp_release:
- 17.4
- 17.3
- 17.2
p = Project.first
p.update(description: <<CONTENT
Here is a description
More description
CONTENT
@danielberkompas
danielberkompas / phoenix_html.log
Created May 11, 2015 18:54
Upgrading to Phoenix 0.13.0
==> phoenix_html
Compiled lib/phoenix_html/engine.ex
lib/phoenix_html/link.ex:1: warning: redefining module Phoenix.HTML.Link
Compiled lib/phoenix_html.ex
Compiled lib/phoenix_html/link.ex
lib/phoenix_html/tag.ex:1: warning: redefining module Phoenix.HTML.Tag
lib/phoenix_html/form_data.ex:17: warning: redefining module Phoenix.HTML.FormData.Plug.Conn
lib/phoenix_html/safe.ex:1: warning: redefining module Phoenix.HTML.Safe
Compiled lib/phoenix_html/form_data.ex
Compiled lib/phoenix_html/tag.ex
@danielberkompas
danielberkompas / compiling.log
Created May 11, 2015 19:02
Complete backtrace of mix deps.get, deps.compile
on_sale [upgrade-phoenix-13●] rm -rf deps
on_sale [upgrade-phoenix-13●] git s
M mix.exs
M mix.lock
on_sale [upgrade-phoenix-13●] mix deps.get
Running dependency resolution
Dependency resolution completed successfully
* Getting phoenix (Hex package)
Checking package (https://s3.amazonaws.com/s3.hex.pm/tarballs/phoenix-0.13.0.tar)
Using locally cached package
@danielberkompas
danielberkompas / date_time_marshaller.rb
Created May 21, 2015 18:42
DateTime marshaler for attr_encrypted
require "attr_encrypted"
require "active_support/core_ext/date_time"
module DateTimeMarshaler
FORMAT = "%F %H:%M:%S"
def self.dump(datetime)
datetime.strftime(FORMAT)
end
@danielberkompas
danielberkompas / scheduler.ex
Created October 26, 2016 17:59
A simple mix task scheduler for Elixir apps
defmodule MyApp.Scheduler do
@moduledoc """
Schedules a Mix task to be run at a given interval in milliseconds.
## Options
- `:task`: The name of the Mix task to run.
- `:args`: A list of arguments to pass to the Mix task's `run/1` function.
- `:interval`: The time interval in millisconds to rerun the task.