Skip to content

Instantly share code, notes, and snippets.

View MarkNijhof's full-sized avatar

Mark Nijhof MarkNijhof

View GitHub Profile
@MarkNijhof
MarkNijhof / ecto_postgres_fulltext_search_querying_example.ex
Created January 21, 2020 00:09 — forked from pmarreck/ecto_postgres_fulltext_search_querying_example.ex
How to set up postgres fulltext search triggers, index, and tsvector column on Elixir/Phoenix, with Ecto querying, including ranking and sorting by rank
defmodule YourAppName.Search do
# ...
@doc """
Queries listings.
"""
def query_listings(query, current_user) do
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^current_user.id, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
@MarkNijhof
MarkNijhof / counter.elm
Created December 20, 2016 02:45 — forked from CliffordAnderson/counter.elm
Elm Counter Example
module Main exposing (..)
import Html exposing (br, button, div, text)
import Html.Events exposing (onClick)
import Html.App exposing (beginnerProgram)
main : Program Never
main =
beginnerProgram { model = model, view = view, update = update }
@MarkNijhof
MarkNijhof / Foo.elm
Created December 11, 2016 21:41 — forked from michie1/Foo.elm
Decode Maybe type
module Foo exposing (..)
import Json.Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
type alias Boat =
{ color : Maybe Color
}
@MarkNijhof
MarkNijhof / movedigiphotos.bash
Created August 2, 2016 13:18 — forked from jvhaarst/movedigiphotos.bash
Bash script to move images, based on exif data and file timestamp
#!/bin/bash
# Reads EXIF creation date from all .JPG files in the
# current directory and moves them carefully under
#
# $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
@MarkNijhof
MarkNijhof / osx-10.9-setup.md
Created November 3, 2015 22:04 — forked from kevinelliott/osx-10.9-setup.md
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store