Skip to content

Instantly share code, notes, and snippets.

View ragiragi's full-sized avatar

Seong-Rak Choi ragiragi

  • KakaoBank
  • Seoul, Pangyo
View GitHub Profile
@ragiragi
ragiragi / aoc2019-day4-part1.ex
Last active December 27, 2019 15:23
Advent of Code 2019, Day4 Part 1, 2
defmodule Day4 do
def run() do
138_307..654_504
|> Enum.map(&number_to_digits/1)
|> Enum.reduce(0, fn digits, count ->
if valid_password?(digits) do
count + 1
else
count
end
@ragiragi
ragiragi / aoc2019-day3-part2.exs
Created December 27, 2019 14:28
Advent of Code 2019, Day3 Part 2
defmodule Day3Part2 do
@central_port {0, 0}
def run() do
p1 = read_path()
p2 = read_path()
intersection(p1, p2)
|> Enum.reject(&central_port?/1)
|> Enum.map(fn pos ->
@ragiragi
ragiragi / aoc2019-day3-part1.ex
Created December 8, 2019 07:55
Advent of Code 2019, Day3 Part 1
defmodule Day3 do
@central_port {0, 0}
def run() do
p1 = read_path()
p2 = read_path()
intersection(p1, p2)
|> Enum.reject(&central_port?/1)
|> Enum.map(&manhattan_distance/1)
@ragiragi
ragiragi / aoc2019-day2-part2.ml
Last active December 8, 2019 06:41
Advent of Code 2019, Day 2 part 2
open Base
open Stdio
type program = (int array) * int
type opcode = Add | Multiply | Halt
type instruction = opcode * int * int * int
let opcode_of_int = function
@ragiragi
ragiragi / aoc2019-day2-part1.ml
Created December 5, 2019 03:42
Advent of Code 2019, Day 2 part 1
open Base
open Stdio
type program = (int array) * int
type opcode = Add | Multiply | Halt
let opcode_of_int = function
| 1 -> Add
| 2 -> Multiply
@ragiragi
ragiragi / aoc2019-day1.ml
Created December 4, 2019 13:56
Advent of Code 2019, Day 1
open Base
open Stdio
let calc_fuel mass = mass / 3 - 2
let rec get_fuel acc mass =
match mass with
| m when m <= 0 -> acc
| m ->
let fuel = calc_fuel m in
@ragiragi
ragiragi / custom_cookie_jar.rb
Created November 2, 2015 08:19
rails cookie jar monkey patch
@ragiragi
ragiragi / assume_overlap_fail.html
Created November 5, 2014 07:06
sample code for composition calculation problem on blink
<!DOCTYPE html>
<html lang="ko">
<head>
<title>assumedOverlap Fail</title>
<meta name="viewport"
content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width"/>
<style>
div { padding: 20px;}
</style>
</head>
@ragiragi
ragiragi / align-flexbox.html
Created September 5, 2014 06:55
align text node with flexbox
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width, target-densityDpi=medium-dpi" />
<title>align text node with flexbox</title>
<style>
.box {
background: #ddd;
width: 300px;
height: 200px;
@ragiragi
ragiragi / index.html
Created July 23, 2014 01:53
Android Browser Memory Leak Pattern Test
<!doctype html>