Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block zimt28

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 context.ex
defmodule Context do
@moduledoc false
defmacro __using__(opts) do
repo = Keyword.fetch!(opts, :repo)
quote do
import Context, only: [context: 1, context: 2]
Module.put_attribute(__MODULE__, :__repo__, unquote(repo))
bruce /
Last active Nov 2, 2019
Very brief description of how Absinthe processes GraphQL
LostKobrakai /
Last active Aug 11, 2019 — forked from nahtnam/
Using Laravel-Mix with Phoenix


Laravel-Mix is "an elegant wrapper around Webpack for the 80% use case". It has nothing to do with Elixir's Mix and does not require Laravel to work!

Set up

Create a new phoenix application with mix You may choose to add the --no-brunch flag to stop brunch from being intiailized, but I personally prefer leaving that in and replacing brunch so that the folder structure is set up for me.

$ mix demo

Install Laravel-Mix

yang-wei /
Last active Feb 4, 2020
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !


myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
sikanhe / improved_cache.js
Last active Nov 20, 2017
Most efficient way to store domain state in Redux (Indexed Key-Value Store)
View improved_cache.js
//After working on the backend for a while, I started to continue working on my front end,
//I revisited my redux “cache” store and I made this improvement that made my life a lot easier.
//In my project for example, some collections i need to get the document by id, some by slug, some by username, and etc.
//If I need to account for those cases I had to make new action creators/types, for different entities.
//This is very frustrating as it makes the code less dry and leads to more boilerplate.
//Then what I realized was, I can just pass a “index” option for my insert action creators!(which defaults to “id")
facto / Gulpfile.js
Last active Jul 10, 2019
Replacing Brunch with Gulp in Phoenix
View Gulpfile.js
// Contains support for: SASS/SCSS, concatenation, and minification for JS and CSS
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var compress = require('gulp-yuicompressor');
OlegIlyenko / Event-stream based GraphQL
Last active Feb 8, 2020
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

websymphony / ecto_table_with_uuid_primary_key.exs
Last active Sep 7, 2016
Use UUIDs as primary key with Ecto - Phoenix Framework
View ecto_table_with_uuid_primary_key.exs
defmodule Blog.Repo.Migrations.CreatePost do
use Ecto.Migration
def up do
create table(:posts, primary_key: false) do
add :id, :uuid, primary_key: true
add :title, :string
add :body, :text

Folder Structure


  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
BretFisher / checkForSettings.js
Created Jan 15, 2015
Meteor App Check for Ensuring You're Using --settings
View checkForSettings.js
// lets complain to server command line if you forgot --settings when running Meteor
Meteor.startup(function () {
if (Meteor.isServer) {
if (Object.keys(Meteor.settings).length === 0) {
console.log("You forgot to run Meteor with --settings!");
You can’t perform that action at this time.