Skip to content

Instantly share code, notes, and snippets.

View hodak's full-sized avatar
🦾
https://ubots.co

Adam Hodowany hodak

🦾
https://ubots.co
View GitHub Profile

Keybase proof

I hereby claim:

  • I am hodak on github.
  • I am hodak (https://keybase.io/hodak) on keybase.
  • I have a public key ASAWZl8y2MF-tVTL4UgZtZkWQ9im_l-ijNUBUPznd2ki5Qo

To claim this, I am signing this object:

@hodak
hodak / decompile.exs
Created September 1, 2018 15:13
Courtesy of @teamon. Put these files in /usr/local/bin
#!/usr/bin/env elixir
defmodule Decompile do
def main([beam_file]) do
{:ok,{_,[{:abstract_code,{_,ac}}]}} = :beam_lib.chunks(to_charlist(beam_file),[:abstract_code])
:io.fwrite("~s~n", [:erl_prettypr.format(:erl_syntax.form_list(ac))])
end
end
Decompile.main(System.argv)
@hodak
hodak / verk.rb
Created January 16, 2018 16:47
ruby verk adapter
module Verk
class Adapter
NAMESPACE = "queue"
QUEUE = "default"
def initialize
@redis = Redis.new(url: APP_CONFIG[:redis_url])
end
def enqueue(module_name, args)
http://jsbin.com/jiyoxiq/1/edit?js,console,output
defmodule WebDAVWorker do
use GenServer
# Client
def start_link do
GenServer.start_link(__MODULE__, [])
end
def run_action(pid, action_handler, args \\ [], delay \\ 0) do
@hodak
hodak / Vagrantfile
Created October 6, 2016 12:07
Add SSH key as authorized key for Vagrant's root
Vagrant.configure(2) do |config|
...
id_rsa_pub = File.read("#{Dir.home}/.ssh/id_rsa.pub")
config.vm.provision "copy ssh public key", type: "shell",
inline: "echo \"#{id_rsa_pub}\" >> /home/vagrant/.ssh/authorized_keys"
end
@hodak
hodak / gist:15c63c024d59be5061c3
Created January 15, 2016 08:09
angular-ui-tree: JavaScript runtime error: Object doesn't support property or method 'contains'
// There's an issue in ui-tree:
// - https://github.com/angular-ui-tree/angular-ui-tree/issues/318
// Waiting for Pull Request to be merged:
// - https://github.com/angular-ui-tree/angular-ui-tree/pull/648
// Issue type is very similar to this in angular.js:
// - https://github.com/angular/angular.js/issues/10259
// Function aliasing: http://stackoverflow.com/a/1007433/1023664
// Recommendation: Update angular-ui-tree after the pull request is merged
if(typeof document.contains === "undefined") {
@hodak
hodak / README.md
Last active November 23, 2015 20:00
KNTAW - Workshop 4, AngularJS
@hodak
hodak / test.coffee
Last active October 15, 2015 13:33
How to stub filter with Angular and Karma
$filter = undefined
beforeEach ->
angular.mock.module ($provide) ->
$provide.value "translateFilter", (key) ->
"TRANSLATED_#{key}"
# Without explicitly returning or returning "null" it raises error
# https://groups.google.com/forum/#!msg/angular/gCGF_B4eQkc/XjkvbgE9iMcJ
return
$scope.dateDbA = moment();
$scope.optionsDbA = {};
$scope.dateDbB = moment();
$scope.optionsDbB = {};
<mighty-datepicker ng-model="dateDbA" options="optionsDbA" before="dateDbB"></mighty-datepicker>
<mighty-datepicker ng-model="dateDbB" options="optionsDbB" after="dateDbA"></mighty-datepicker>