Skip to content

Instantly share code, notes, and snippets.

View nietaki's full-sized avatar
😌
purposeful

Jacek Królikowski nietaki

😌
purposeful
View GitHub Profile
# aliases and imports omitted
query =
from(c in Comment,
where: c.user_id == ^charlie_id,
preload: [:post]
)
comments_by_charlie = Repo.all(query)
refute Enum.any?(comments_by_charlie, fn c -> c.post == nil end)
alias BlogExample.Schema.Comment
import Ecto.Query, only: [from: 2]
query =
from(c in Comment,
where: c.user_id == ^charlie_id
)
comments_by_charlie = Repo.all(query)
defmodule BlogExample.Schema.User do
use Ecto.Schema
schema "users" do
field(:username, :string, null: false)
field(:full_name, :string)
has_many(:posts, BlogExample.Schema.Post)
has_many(:comments, BlogExample.Schema.Comment)
end
public class Solution {
public int solution(int[] radiuses) {
int length = radiuses.length;
int[] startCounts = new int[length];
int[] endCounts = new int[length];
// make sure there's no overflows
for (int i = 0; i < length; i++) {
radiuses[i] = Math.min(length, radiuses[i]);
}
https://my.pcloud.com/#page=puplink&code=4tvZTrwxhAmIOn0mAATwUzeMEXARCcqk
bdbd
@nietaki
nietaki / cloudSettings
Last active July 5, 2018 16:29
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-07-05T16:29:37.163Z","extensionVersion":"v2.9.2"}
defmodule EvilModuleCompiledInAtRuntime do
@all_your_base """
/+++++++++++++++++++++++++++++++/`...``-``...-..-...-..`` `+++++++++++++++++++++++++++++++++++++++/
+sssssssssssssssssssssssssssssss:-`-.`.:........-....-..` `sssssssssssssssssssssssssssssssssssssss/
+sssssssssssssssssssssssssssssss.-`-.`.-.-.-..-.-.......` `ossssssssssssssssssssssssssssssssssssss/
+sssssssssssssssssssssssssssssss..`-.`..-.--..-.`..-.... +ssssssssssssssssssssssssssssssssssssss/
+sssssssssssssssssssssssssssssss.``-.....---//:::----.`` ` +ssssssssssssssssssssssssssssssssssssss/
+sssssssssssssssssssssssssssssss:.`-`..-:/::+o+oooo+/:.` ` -sssssssssssssssssssssssssssssssssssssss/
+sssssssssssssssssssssssssssssss+`-...../--/o+/+oooo//-.` .:+ossssssssssssssssssssssssssssssssssss/

Keybase proof

I hereby claim:

  • I am nietaki on github.
  • I am nietaki (https://keybase.io/nietaki) on keybase.
  • I have a public key ASDOOX2N52x1hpreG-_F0sRXBHL5frFuA-SThCpI2A6mgwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am nietaki on github.
  • I am nietaki (https://keybase.io/nietaki) on keybase.
  • I have a public key ASApsIeIUzBCJLU6yHqbja6JtBrSVjjHnWApvN8x7JCkWAo

To claim this, I am signing this object:

;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory