Skip to content

Instantly share code, notes, and snippets.

Avatar

Pahlevi Fikri Auliya fikriauliya

  • Singapore
View GitHub Profile
@busypeoples
busypeoples / PhantomTypeReasonML.md
Last active Nov 28, 2020
Phantom types in ReasonML
View PhantomTypeReasonML.md

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.

@idibidiart
idibidiart / GraphQL-Architecture.md
Last active Dec 6, 2020
Building an Agile, Maintainable Architecture with GraphQL
View GraphQL-Architecture.md

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active Jan 24, 2021
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
View ALTERNATIVES.adoc
@hopsoft
hopsoft / db.rake
Last active Jan 10, 2021
Rails rake tasks for dump & restore of PostgreSQL databases
View db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@brysgo
brysgo / post_checkout_migrations.sh
Last active Oct 5, 2019 — forked from jonlemmon/rails_switch_branch.py
Post checkout hook for managing rails migrations and bundle install
View post_checkout_migrations.sh
CHECKING_OUT_BRANCH=$3
OLD_BRANCH=$1
NEW_BRANCH=$2
if [ $CHECKING_OUT_BRANCH -eq 1 ]
then
FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status`
MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r`
MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'`
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a