Skip to content

Instantly share code, notes, and snippets.

View qcam's full-sized avatar

Cẩm Huỳnh qcam

View GitHub Profile
[
{
"source": "quan-cam.com",
"url": "https://quan-cam.com/rss",
"category": "personal"
},
{
"source": "medium.com/@hqc",
"url": "https://medium.com/feed/@hqc",
"category": "personal"
@qcam
qcam / capybara-wait-for-ajax.md
Created May 3, 2014 00:41
Wait for AJAX in Capybara

Wait for AJAX Capybara

Add wait_for_ajax to your helper

def wait_for_ajax
  Timeout.timeout(Capybara.default_wait_time) do
    loop do
      active = page.evaluate_script('jQuery.active')
 break if active == 0
{"data":{"build-a-blog-in-elixir-with-nabo-and-phoenix":[{"content":"# g","created_at":"2019-01-14T08:18:53.347875Z","user":{"avatar_url":"https://avatars2.githubusercontent.com/u/26930297?v=4","name":"Kalipts","provider":"github","provider_user_url":"https://github.com/Kalipts"}}],"chet-server-lam-gi-day":[{"content":"s","created_at":"2019-06-24T13:33:26.312600Z","user":{"avatar_url":"https://avatars2.githubusercontent.com/u/35627119?v=4","name":"Juniorsz","provider":"github","provider_user_url":"https://github.com/Juniorsz"}}],"chuyen-an-cap":[{"content":"Vậy nếu vi phạm Creative Commons License thì sẽ bị 'xử lý' như thế nào vậy anh?","created_at":"2018-04-22T14:40:23.413143Z","user":{"avatar_url":"https://avatars3.githubusercontent.com/u/15165794?v=4","name":"j1nz","provider":"github","provider_user_url":"https://github.com/j1nz"}},{"content":"[@j1nz](https://github.com/j1nz) Mình cũng chả muốn \"xử lý\" làm gì cả ☹️. Mình là developer, mình không phải luật sư. Mình chúc họ cắn rứt lương tâm vậy.","created
defmodule GCounter.Node do
use GenServer
def start_link(node_name) do
GenServer.start_link(__MODULE__, node_name, [name: node_name])
end
@impl true
def init(node_name) do
init_counter = %{node_name => 0}
@qcam
qcam / rfc822.ex
Last active January 4, 2024 10:37
nimble_parsec example with RFC822 datetime parser (https://www.ietf.org/rfc/rfc822.txt)
defmodule RFC822 do
import NimbleParsec
day =
choice([
string("Mon"),
string("Tue"),
string("Wed"),
string("Thu"),
string("Fri"),