Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Nicolas Blanco nicolasblanco

🎯
Focusing
Block or report user

Report or block nicolasblanco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicolasblanco
nicolasblanco / gist:d1549bf96616eb22b87c7919a085035b
Created May 31, 2019
Phoenix app crashing multiple times in loop in dev env with each compilation
View gist:d1549bf96616eb22b87c7919a085035b
[info] GET /dashboard/tos_acceptance/edit
[debug] QUERY OK source="users" db=0.4ms
SELECT u0."id", u0."first_name", u0."last_name", u0."address", u0."city", u0."country", u0."nationality", u0."email", u0."company_name", u0."zip_code", u0."region_code", u0."phone_number", u0."date_of_birth", u0."description", u0."facebook_uid", u0."google_uid", u0."coordinates", u0."lat", u0."lng", u0."images_group_url", u0."banner_image_url", u0."retrieval_information", u0."encrypted_password", u0."role", u0."reset_password_token", u0."reset_password_sent_at", u0."general_tos_accepted_at", u0."producer_tos_accepted_at", u0."mangopay_user_id", u0."slug", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."id" = $1) [2]
[debug] Processing with DokkitoWeb.Dashboard.TosAcceptanceController.edit/2
Parameters: %{}
Pipelines: [:browser, :dashboard]
[info] Sent 200 in 1ms
[info] Replied phoenix:live_reload :ok
[error] #PID<0.2434.0> running DokkitoWeb.Endpoint (connection #PID<0.2433.0>, stream id 1) terminated
Server
View 01.ex
with {:ok, result} <- do_some_heavy_stuff,
{:ok, second_result} <- do_other_stuff(result) do
send_email(second_result)
else
error -> # ...
end
View 01.rb
if result = do_some_heavy_stuff
if second_result = do_other_stuff(result)
send_email(second_result)
else
# ...
end
else
# ...
end
View force_slug_generation.ex
defmodule EctoAutoslugField.ForceSlugGeneration do
alias EctoAutoslugField.SlugBase
defmacro __using__(_opts) do
quote do
def force_generate_slug(changeset) do
opts = [
from: @from,
to: @to,
always_change: true,
View auth_controller.ex
defmodule DokkitoWeb.AuthController do
use DokkitoWeb, :controller
# ...
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
case Auth.find_or_create(auth) do
{:ok, user} ->
conn
|> put_flash(:info, "Successfully authenticated.")
View gitconfig
[alias]
co = checkout
st = status -sb
br = branch
ci = commit
fo = fetch origin
d = !git --no-pager diff
dt = difftool
stat = !git --no-pager diff --stat
View vscode.json
{
"window.zoomLevel": 0,
"editor.fontSize": 16,
"editor.tabSize": 2,
"window.openFilesInNewWindow": "off",
"files.insertFinalNewline": true,
"ruby.lint": {
"rubocop": true,
"ruby": true
},
View index.html
<div class="row">
<div class="col-sm-6 col-md-6">
1ere colonne
</div>
<div class="col-sm-6 col-md-6">
2eme colonne
</div>
</div>
View gist:a901633e902180f7214dcfb0629b4f80
irb(main):011:0> Product.where("name_translations->>'en' = ?", "My great product").first
=> #<Product id: 1, sku: "SKU", name_translations: ...
View products_controller.rb
def product_params
params.require(:product).permit(:sku, name_translations: I18n.available_locales)
end
You can’t perform that action at this time.