I hereby claim:
- I am yuchunc on github.
- I am mickeychen (https://keybase.io/mickeychen) on keybase.
- I have a public key ASCNsnzV1ahcwLeWs-iFVGJ4ewSMGbCLn7iUTiGgAJ3X-wo
To claim this, I am signing this object:
defmodule EctoQueryMaker do | |
@moduledoc """ | |
Query builder to abstract away boilerplate queries. | |
""" | |
import Ecto.Query | |
alias Ecto.{Query, Queryable} | |
@callback apply_filter(filter :: atom | {atom, any}, query :: Query.t()) :: Query.t() |
// an example to create a new mapping `ctrl-y` | |
mapkey('<Ctrl-y>', 'Show me the money', function() { | |
Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); | |
}); | |
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works. | |
map("K", "R"); | |
map("J", "E"); | |
map("H", "S"); | |
map("L", "D"); |
defmodule MedianSortedTuple do | |
# NOTE Alogorithm 4 | |
def attempt2(tup1, tup2) do | |
size1 = tuple_size(tup1) | |
size2 = tuple_size(tup2) | |
half_size = (size1 + size2 + 1) |> div(2) | |
if size1 > size2 do |
# NOTE this is a failed attempt | |
defmodule MedianSortedTuple do | |
# NOTE Alogorithm 4 | |
def find({}, {}), do: 0 | |
def find(tup1, tup2) do | |
full_size = tuple_size(tup1) + tuple_size(tup2) |
defmodule CombineInterval do | |
def merge_interval([]), do: [] | |
def merge_interval([h | t]), do: merge_interval(t, [h]) | |
def merge_interval([], acc), do: Enum.reverse(acc) | |
def merge_interval([h | t], acc = [acc_h | acc_t]) do | |
{start, _leng} = h | |
{acc_h_start, acc_h_leng} = acc_h |
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do | |
{:ok, user} = Account.fb_auth(auth.uid, auth.info) | |
Streaming.find_or_create_channel(user) | |
conn | |
|> Guardian.Plug.sign_in(user) | |
|> put_flash(:success, "Signed In!") | |
|> redirect(to: "/") | |
end |
I hereby claim:
To claim this, I am signing this object:
year=$(date +%Y) | |
month=$(date +%m) | |
date=$(date +%Y-%m-%d) | |
j_dir="~/Dropbox/daily_journal/$year/$month" | |
j_file="~/Dropbox/daily_journal/$year/$month/$date" | |
alias wj="mkdir -p $j_dir && cp ~/Dropbox/daily_journal/template $j_file && vim $j_file" |
#!/bin/zsh | |
UNSORTED_DIR=./sample_files/* | |
MEMORIA_DIR=./memoria | |
OTHER_DIR=./other_files | |
image_formats="jpg|jpeg|jif|jfif|jp2|jpx|j2k|j2c|tif|gif|pfx|pcd|png" | |
video_formats="3g2|3gp|asf|avi|flv|m4v|mov|mp4|mpg|rm|srt|swf|vob|wmv" | |
for some_file in $UNSORTED_DIR |
# Directly copied from eycap-0.5.2 (thanks!) | |
# | |
# With these tasks you can: | |
# - dump your production database and save it in shared_path/db_backups | |
# - dump your production into your local database (clone_to_local) | |
# | |
# Tested and fixed by fjguzman | |
Capistrano::Configuration.instance(:must_exist).load do | |
namespace :db do |