Skip to content

Instantly share code, notes, and snippets.

View pierreabreup's full-sized avatar

Pierre Abreu pierreabreup

View GitHub Profile
@erikreedstrom
erikreedstrom / bcp47.ex
Created February 13, 2016 16:25
Elixir module for parsing bcp 47 (https://tools.ietf.org/html/bcp47) spec'd language tags.
defmodule BCP47 do
@moduledoc ~S"""
Main BCP47 module.
The `BCP47` module provides a parser for
[bcp 47](https://tools.ietf.org/html/bcp47) spec'd language tags.
"""
@type tag :: String.t
@erikreedstrom
erikreedstrom / blank.ex
Created February 13, 2016 17:54
Blank protocol for Elixir
defmodule Blank do
@moduledoc """
Tools around checking and handling undefined or blank data.
"""
@doc """
Returns `true` if data is considered blank/empty.
"""
def blank?(data) do
Blank.Protocol.blank?(data)
@LawJolla
LawJolla / schema.ex
Created April 10, 2017 23:44
Absinthe Root Query Pagination
defmodule WkGraphql.Schema do
use Absinthe.Schema
import_types WkGraphql.Schema.Types
query do
@desc "Get a user"
field :user, :user do
arg :id, non_null(:integer)
resolve &WkGraphql.UserResolver.find/2
@tomasfejfar
tomasfejfar / docker-compose.yml
Created April 3, 2018 11:35
Using YAML to reuse parts of existing docker-compose configuration
version: "3"
services:
apache: &apacheConfig
build: .
volumes:
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
working_dir: /var/www/html
ports:
@sarjarapu
sarjarapu / userDefinedRole-createRole.sh
Created May 16, 2018 14:42
A bash script with MongoDB commands to create a user-defined role and a user.
mongo social --port 28000 -u user -p password --authenticationDatabase admin <<EOF
db.createRole({
role: "readWriteMinusDropRole",
privileges: [
{
resource: { db: "social", collection: ""},
actions: [ "collStats", "dbHash", "dbStats", "find", "killCursors", "listIndexes", "listCollections", "convertToCapped", "createCollection", "createIndex", "dropIndex", "insert", "remove", "renameCollectionSameDB", "update"]} ],
roles: []
}
);