Skip to content

Instantly share code, notes, and snippets.

View bahulneel's full-sized avatar

Bahul Neel Upadhyaya bahulneel

View GitHub Profile
@bahulneel
bahulneel / design.md
Last active December 7, 2023 10:21
Hybr Automated Vetting Design

Design

Data model

---
title: Vetting Preferences Entity Relationships
---
erDiagram
    Property 1--0+ PropertyTenant : prefers
    PropertyTenant {

Keybase proof

I hereby claim:

  • I am bahulneel on github.
  • I am bahulneel (https://keybase.io/bahulneel) on keybase.
  • I have a public key ASBoanAStRexJFUVJy0Fn5nlg8N-16hKzUT8YN-MZk3f1wo

To claim this, I am signing this object:

@bahulneel
bahulneel / negation.clj
Created March 20, 2018 15:20
Not Join in datascript
(def conn (d/create-conn {}))
(def data
[{:a 1 :b 2}
{:a 2 :b 3 :c true}])
(d/transact! conn data)
(defn not-join
[db q vars where]
@bahulneel
bahulneel / pull_one.clj
Created September 20, 2016 15:15
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]]
(defn wrap-save-content [handler content-type]
(fn [request]
(if (= content-type (get-in request [:headers "Content-Type"]))
(let [temp-file (clojure.java.io/file ...)]
(copy (:body request) temp-file)
(handler (assoc request :body temp-file)))
(handler request))))
@bahulneel
bahulneel / timeQueries.php
Created January 20, 2012 19:22
Counts queries and the time they spend executing
<?php
function removeVars($sql)
{
$sql = preg_replace('/(\b)\d+(\b)/', '\1?\2', $sql);
$sql = str_replace('?, ', '', $sql);
$sql = str_replace("\t", ' ', $sql);
return $sql;
}