Skip to content

Instantly share code, notes, and snippets.

View vic's full-sized avatar
🤮
puke nuke

Victor Borja vic

🤮
puke nuke
View GitHub Profile
@vic
vic / ex14parens.rb
Created December 9, 2016 09:13
Add missing parentheses to avoid Elixir 1.4 warnings on function calls.
#!/usr/bin/env ruby
###
# This utility adds missing parentheses to single word function calls
# that are now treated as warnings on Elixir 1.4.
#
# Download this file on your project repo and execute
# ruby ex14parens.rb --help
####
require('fileutils')
@vic
vic / README.md
Last active April 3, 2018 05:54
Rebecca iterm2 colors

Install d12frosted/emacs-plus on mac patched for rich colors on terminals supporting direct color (like iterm2).

brew install emacs-plus --with-24bit-color

Generate the terminfo (see attached .src file)

Then run emacs/emacsclient with TERM set to xterm-24bits

@vic
vic / ytpls.sh
Last active February 2, 2018 20:54
Save a YouTube list as a playlist of videos.
#!/usr/bin/env bash
#
# ytpls.sh - Save a YouTube list as a playlist of videos.
#
#
# Doesnt actually download the videos, it just creates a playlist file `.pls` containing each video url.
# You can open such files with VLC or other media player on desktop and mobile.
#
#
# USAGE
@vic
vic / redy.js
Created November 5, 2008 18:43
/**
* Redy - a prototype for a ruby like javascript.
* Parts of this software are derived from JS.Class by James Coglan.
*
*
* This file is licensed under the Ruby licenense.
* Copyright 2008. Victor Hugo Borja <vic.borja gmail.com>
*/
Redy = {
@vic
vic / type.yaml
Created January 7, 2017 07:52
type
2017-01-01:
2017-01-02:
2017-01-03:
2017-01-04:
2017-01-05:
2017-01-06:
2017-01-07:
2017-01-08:
defmodule DefGuard do
defp defguardp(defwith, name, meta = [{:when, _}, {:args, args} | _]) do
meta = meta |> Macro.escape
quote do
@expects {unquote(name), unquote(meta)}
unquote(defwith)(unquote(:"#{name}?")(unquote_splicing(args))) do
values = unquote(args |> Enum.map(fn value = {name, _, nil} -> {name, value} end))
unquote(meta[:when]) |> Macro.prewalk(fn
{name, _, nil} -> Keyword.get(values, name)
@vic
vic / compile.log
Created December 18, 2016 23:02
proof-general warnings on coq-layer installation
Leaving directory ‘/Users/vic/.emacs.d/elpa/proof-general-20161216.202’
Compiling file /Users/vic/.emacs.d/elpa/proof-general-20161216.202/acl2/acl2.el at Sun Dec 18 17:00:39 2016
Entering directory ‘/Users/vic/.emacs.d/elpa/proof-general-20161216.202/acl2/’
Leaving directory ‘/Users/vic/.emacs.d/elpa/proof-general-20161216.202/acl2/’
Compiling file /Users/vic/.emacs.d/elpa/proof-general-20161216.202/ccc/ccc.el at Sun Dec 18 17:00:39 2016
Entering directory ‘/Users/vic/.emacs.d/elpa/proof-general-20161216.202/ccc/’
Leaving directory ‘/Users/vic/.emacs.d/elpa/proof-general-20161216.202/ccc/’
@vic
vic / macro.ex
Created December 15, 2016 09:34
Macro schema objects for absinthe. see https://github.com/absinthe-graphql/absinthe/issues/232
defmodule Absinthe.Schema.Notation.Macro do
defmacro macro_field(name, a, b) do
macro(:field, [name, a, b])
end
defmacro macro_object(name, a) do
macro(:object, [name, a])
end
@vic
vic / README.md
Last active December 9, 2016 21:22
Display elixir exceptions / mix test / credo as iTerm2 notifications.

Open your iTerm2 preferences, then under Profiles / Advanced / Triggers add some regular expressions for the errors you want to notify. On Action select Post Notification, if the regex has group captures, you can use them as parameters.

FunTip: Under Action select Run Command with parameters: say "\1"

ProTip: mix test --listen-on-stdin will re-run tests when you hit enter. Others like to use the mix_test_watch package, but I prefer not to add another dependency.