Skip to content

Instantly share code, notes, and snippets.

Michael mazz

Block or report user

Report or block mazz

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
View ValueObservation.swift
let databasePool: DatabasePool = self.userService.rawDatabasePool()
let coursesObservation = ValueObservation.tracking { db -> [MbyCourse] in
var courses: [MbyCourse] = []
do {
let mbyCourses = try MbyCourse
.filter(Column("orgUuid") == self.orgUuid.value) // also tried removing this filter line
.filter(Column("archived") == false) // also tried removing this filter line
.fetchAll(db)
courses = mbyCourses
View deploy.log
Attaching to faithfulword-phx_proxy_1, faithfulword-phx_postgres_1, faithfulword-phx_faithful_word_1
proxy_1 | time="2019-10-09T02:19:28Z" level=info msg="Traefik version v1.7.18 built on 2019-09-26_01:56:30PM"
proxy_1 | time="2019-10-09T02:19:28Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v1.7/basics/#collected-data\n"
proxy_1 | time="2019-10-09T02:19:29Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0009500e0} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
proxy_1 | time="2019-10-09T02:19:29Z" level=info msg="Preparing server https &{Address::443 TLS:0xc0004b4480 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0009501a0} with readTimeout=0s writeTimeout=0s
@mazz
mazz / stuff.ex
Created Feb 20, 2019
Phoenix.Template.UndefinedError
View stuff.ex
Phoenix.Template.UndefinedError at GET /
Could not render "app.html" for WordApi.LayoutView, please define a matching clause for render/2 or define a template at "lib/faithful_word_api/templates/layout". No templates were compiled for this module. Assigns:
%{__phx_template_not_found__: WordApi.LayoutView, conn: %Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{layout: {WordApi.LayoutView, "app.html"}}, before_send: [#Function<0.116269836/1 in Plug.CSRFProtection.call/2>, #Function<2.65282597/1 in Phoenix.Controller.fetch_flash/2>, #Function<0.58261320/1 in Plug.Session.before_send/2>, #Function<1.112466771/1 in Plug.Logger.call/2>, #Function<0.66982185/1 in Phoenix.LiveReloader.before_send_inject_reloader/2>], body_params: %{}, cookies: %{"cookieconsent_status" => "dismiss"}, halted: false, host: "localhost", method: "GET", owner: #PID<0.736.0>, params: %{}, path_info: [], path_params: %{}, port: 4000, private: %{WordApi.Router => {[], %{}}, :phoenix_action => :index, :phoenix_controller => WordApi.Pa
View snippet.swift
public func fetchCourses() -> Single<[MbyCourse]> {
return Single.create { [unowned self] single in
do {
var fetchCourses: [MbyCourse] = []
// let chapters: [Org]!
try self.dbPool.read { db in
fetchCourses = try MbyCourse.fetchAll(db)
}
single(.success(fetchCourses))
} catch {
@mazz
mazz / unicode.patch
Created May 14, 2018
patches j2py to handle unicode
View unicode.patch
diff --git a/bin/j2py b/bin/j2py
index 6eb1a40..b618693 100755
--- a/bin/j2py
+++ b/bin/j2py
@@ -6,9 +6,11 @@ This is all very ordinary. We import the package bits, open and read
a file, translate it, and write it out.
"""
+from __future__ import unicode_literals
import sys
View Playlist.swift
import Foundation
import GRDB
public struct Playlist: Codable {
var uuid: String
public var channelUuid: String
public var bannerPath: String?
public var localizedname: String
public var languageId: String
public var mediaCategory: String
View Dockerfile
# docker build -t olivetree:builder --target=builder .
FROM elixir:1.8.1-alpine as builder
RUN apk add --no-cache \
gcc \
git \
make \
musl-dev
RUN mix local.rebar --force && \
mix local.hex --force
WORKDIR /app
View iex.log
iex(2)> import Ecto.Query
Ecto.Query
iex(3)> Video |> select([v], v.id)
#Ecto.Query<from v0 in DB.Schema.Video, select: v0.id>
iex(4)> Video |> select([v], v.id) |> DB.Repo.all()
[debug] QUERY OK source="videos" db=1.9ms decode=2.6ms queue=6.5ms
SELECT v0."id" FROM "videos" AS v0 []
[1]
iex(5)> Video |> select([v], v.id) |> DB.Repo.all() |> Enum.map(&Video.changeset_generate_hash_id/1)
[debug] QUERY OK source="videos" db=0.3ms
View config.exs
...
config :my_app_api, MyAppApi.Endpoint,
url: [host: "api.%%%%.app"],
secret_key_base: "%%%%",
render_errors: [view: MyAppApi.ErrorView, accepts: ~w(html json)],
pubsub: [name: MyAppApi.PubSub, adapter: Phoenix.PubSub.PG2],
live_view: [signing_salt: "%%%%"]
...
View compile_error.ex
# ** (Ecto.Query.CompileError) Tuples can only be used in comparisons with literal tuples of the same size
def search(query_string, offset \\ 0, limit \\ 0,
media_category,
playlist_uuid,
channel_uuid,
published_after
) do
conditions = false
You can’t perform that action at this time.