Skip to content

Instantly share code, notes, and snippets.

View ahmadrasyidsalim's full-sized avatar

ahmadrasyidsalim

View GitHub Profile
@ahmadrasyidsalim
ahmadrasyidsalim / pull_one.clj
Created March 12, 2023 09:39 — forked from bahulneel/pull_one.clj
Get all the attributes of a datomic entity (1 deep)
(->> eid
(d/q '[:find ?an ?v ?cn
:in $ ?e
:where
[?e ?a ?v]
[?a :db/ident ?an]
[?a :db/cardinality ?c]
[?c :db/ident ?cn]]
db)
(reduce (fn [m [k v c]]
@ahmadrasyidsalim
ahmadrasyidsalim / gist:19e5a4914d0ba7e69b2ef43ffc449f9d
Created March 1, 2023 09:31 — forked from a2ndrade/gist:5655005
Datomic: containment relationships i.e. db/isComponent
(require '[datomic.api :as d])
(def uri "datomic:mem://test")
(d/create-database uri)
(def conn (d/connect uri))
(d/transact conn [;; Article
{:db/id #db/id [:db.part/db]
:db/ident :article/title
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
@ahmadrasyidsalim
ahmadrasyidsalim / cider-opinions.md
Created January 27, 2023 18:21 — forked from levand/cider-opinions.md
Why I don't use cider

Why I don't use cider.

This is all personal opinion and a matter of taste. I'm putting it here because people have asked - I'm glad Cider exists and that a lot of people are obviously using it to great effect. This is not an attack on Cider or a an attempt to negate the experience of those who like it, just my own experience.

Also some of the critiques are more properly aimed at nRepl than Cider - I don't use nRepl either, in Emacs. For some reason I have fewer issues with it in Cursive (though I still do have some).

  1. With Cider, there's too much "going on" between Emacs and Clojure. When something glitches, hangs, doesn't return a value, throws an excption, etc (as it does, multiple times a day), I don't know whether the problem is in Emacs, in the Cider client, the nRepl server, one of any of the default middlewares or in my actual program. I run Emacs in inferior lisp using lein trampoline -m clojure.main - if something goes wrong, it's either in Emacs (which is usually obvious) or my program. Mi
@ahmadrasyidsalim
ahmadrasyidsalim / esm-package.md
Created February 16, 2022 21:31 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ahmadrasyidsalim
ahmadrasyidsalim / introrx.md
Created February 7, 2022 00:30 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ahmadrasyidsalim
ahmadrasyidsalim / redirects-in-react-router-v6.md
Created February 4, 2022 22:34 — forked from mjackson/redirects-in-react-router-v6.md
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

@ahmadrasyidsalim
ahmadrasyidsalim / composing-route-in-react-router-v6.md
Created February 4, 2022 22:31 — forked from mjackson/composing-route-in-react-router-v6.md
Notes on route composition in React Router v6, along with a suggested improvement you can make today to start upgrading

Composing <Route> in React Router v6

Composition of <Route> elements in React Router is changing in v6 from how it worked in v4/5 and in Reach Router. React Router v6 is the successor of both React Router v5 and Reach Router.

This document explains our rationale for making the change as well as a pattern you will want to avoid in v6 and a note on how you can start preparing your v5 app for v6 today.

Background

In React Router v5, we had an example of how you could create a element](https://github.com/remix-run/react-router/blob/320be7afe44249d5c025659bc00c3276a19f0af9/packages/react-router-dom/examples/Auth.js#L50-L52) to restrict access to certain routes on the page. This element was a simple [wrapper around an actual element that made a simple decision: is the user authenticated or not? If so, ren

@ahmadrasyidsalim
ahmadrasyidsalim / private_fork.md
Created February 2, 2022 14:06 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

UPDATE
kas_umum
SET
-- Subquery
-- Kalau hasilnya lebih dari 1 row, error (pengesahan gagal)
-- Apakah logikanya bisa pake IN?
id_rapbs_periode = (SELECT
id_rapbs_periode
FROM
rapbs_periode
UPDATE
k
SET
k.id_rapbs_periode = rp.id_rapbs_periode
FROM
dbo.kas_umum k
JOIN dbo.rapbs_periode rp
ON rp.updater_id = k.id_rapbs_periode
JOIN dbo.rapbs r
ON r.id_rapbs = rp.id_rapbs