Skip to content

Instantly share code, notes, and snippets.

View jechol's full-sized avatar
🎯
Focusing

Jechol Lee jechol

🎯
Focusing
View GitHub Profile
@jechol
jechol / by flow
Created February 19, 2024 23:20
flow vs function
flow do
# Flow arguments allow you to parameterize the flow
argument :org_name, :string do
allow_nil? false
end
argument :user_name, :string do
allow_nil? false
end
@jechol
jechol / day1_2.ex
Last active December 9, 2023 02:44
Advent of Code 2023, Day1 Part2
digits =
(~w(one two three four five six seven eight nine)
|> Enum.with_index(1) ) ++ ( ~w(1 2 3 4 5 6 7 8 9)
|> Enum.with_index(1) ) |> Enum.into(%{})
digits = ~w(1 2 3 4 5 6 7 8 9)
|> Enum.with_index(1) |> Enum.into(digits)
input
|> String.split()
|> Enum.map(fn line ->
@jechol
jechol / nightly
Last active July 19, 2021 07:29
shell.nix for rust
let
moz_overlay = import (fetchTarball {
url = "https://github.com/mozilla/nixpkgs-mozilla/archive/3f3fba4e2066f28a1ad7ac60e86a688a92eb5b5f.tar.gz";
sha256 = "sha256:1mrj89gzrzhci4lssvzmmk31l715cddp7l39favnfs1qaijly814";
});
nixpkgs = import (fetchTarball {
url =
"https://github.com/nixOS/nixpkgs/archive/21.05.tar.gz";
sha256 = "sha256:1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
}) { overlays = [ moz_overlay ]; };
@jechol
jechol / config
Last active June 3, 2018 05:37
.ssh/config
Host *
AddKeysToAgent yes
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
#!/usr/bin/env bash
set -e
pushd .git/hooks > /dev/null
curl -s -O https://gist.githubusercontent.com/jechol/912acf710b02954676045b5dd9eadc23/raw/71e01f0c0f4f45c97805bbabfa6d24ce64fd8fe2/pre-commit
chmod a+x pre-commit
popd > /dev/null
#!/bin/sh
cd `git rev-parse --show-toplevel`
mix format --check-formatted
if [ $? == 1 ]; then
echo "[ERROR!!!] Commit failed because you have format issues..."
echo "[SO WHAT?] Please run mix format and git add/commit again dude. ^^"
exit 1
fi
@jechol
jechol / Brewfile
Created December 29, 2017 01:06
OSX bootstrap
tap "homebrew/bundle"
tap "homebrew/core"
# Java is dependency for followings
cask "java"
# Core utils
cask "iterm2"
brew "fish"
brew "tmux"
@jechol
jechol / address.txt
Created August 15, 2017 11:59
Jechol's Rinkeby address to receive from faucet.
0x3c79af29dB4b55cB0e971e8e05844CB9CD6c6D0c
@jechol
jechol / NestedClosureCaptureTest.swift
Last active January 12, 2017 04:22
Swift nested closure reference capture test
import Foundation
typealias VoidFunc = () -> ()
class Person {
var name: String!
init(_ name: String) {
self.name = name
@jechol
jechol / ios-commands.fish
Last active January 19, 2017 19:47
Commands useful for iOS dev.
function sr
find . -regex '.*\.(swift|storyboard|xib|h|m)' -not -path './Pods/*' | xargs ag -0 -l $argv[1] | xargs perl -i.sr_bak -pe "s/$argv[1]/$argv[2]/g"
find . -regex '.*\.sr_bak' | xargs rm
end
function unowned
for func in observeNext flatMapLatest
sr "\.($func) \{ ([ (:),\w->]+) in" '.$1 { [unowned self] $2 in'
sr "\.($func) \{\n" '.$1 { [unowned self] in\n'
end