.
├── handler.rb
├── layers/
│ ├── Gemfile
│ └── Gemfile.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExCount.CLI do | |
@opts [ | |
strict: [only_line: :boolean], | |
aliases: [l: :only_line] | |
] | |
def main(args) do | |
args | |
|> OptionParser.parse(@opts) | |
|> show_counts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('@rails/ujs').start() | |
require('turbolinks').start() | |
import { Controller, Application } from 'stimulus' | |
import HomeChannel from './home_channel' | |
class HomeController extends Controller { | |
static targets = [ | |
'message' | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import css from "../css/app.css" | |
import "phoenix_html" | |
import UIkit from 'uikit' | |
document.addEventListener('DOMContentLoaded', function() { | |
// Uikit のイベントのハンドリング | |
// Sortable の要素の移動をハンドリング | |
UIkit.util.on('#chapters', 'moved', (event) => { | |
console.log(event.detail) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.field { | |
background-color: #eee; | |
height: 90vh; | |
width: 100%; | |
} | |
.marker { | |
position: relative; | |
left: 10px; | |
height: 10px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule StimulusPhxSampleWeb.Greeter do | |
use GenServer | |
def start_link(_) do | |
GenServer.start_link(__MODULE__, %{}) | |
end | |
def init(state) do | |
schedule_greeting() | |
{:ok, state} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sample of CSV package | |
# | |
# see https://hex.pm/packages/csv | |
"a,b\n1,2\n3,4\n" | |
|> IO.inspect() | |
|> String.split() # split a string into lines | |
|> IO.inspect() | |
|> CSV.decode!(headers: [:a, :b]) # decode with headers | |
|> Enum.to_list() # realize a list of maps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Conv do | |
def get(url) do | |
{:ok, response} = HTTPoison.get(url) | |
:iconv.convert("SJIS", "UTF-8", response.body) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% オフラインリアルタイムどう書く E30 「面白いセルの合計」を Prolog で解いた | |
% http://nabetani.sakura.ne.jp/hena/orde30sumt/ | |
% | |
% 述語 memo/3 を動的に定義することで memoization を実現しています | |
% | |
% 処理系: | |
% GNU Prolog (http://www.gprolog.org) | |
% | |
% コンパイル: | |
% $ gplc --no-top-level orde30.prolog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:ok, greeting, _} = | |
"{{ greeting | capitalize }}, {{ greeting | downcase }}!" | |
|> Liquid.Template.parse() | |
|> Liquid.Template.render(%{"greeting" => "HELLO"}) | |
IO.puts(greeting) | |
# => Hello, hello! |