Skip to content

Instantly share code, notes, and snippets.

View Stvad's full-sized avatar

Vlad Sitalo Stvad

View GitHub Profile
@Stvad
Stvad / f.json
Last active August 15, 2021 23:20
comment queries on daily pages
[{"create-time":1629041510869,"title":"comment queries on daily pages",":create/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"},"children":[{"string":"isa::[[iroam/notebook]]","create-time":1629041512459,":block/refs":[{":block/uid":"pt_Ivza0F"},{":block/uid":"FxnP85ywT"}],"refs":[{"uid":"pt_Ivza0F"},{"uid":"FxnP85ywT"}],":create/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"},"uid":"hw_U21Vfv","edit-time":1629041523012,":edit/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"}},{"string":"```javascript\nfunction addDays(original, days) {\n let date = new Date(original.valueOf());\n date.setDate(date.getDate() + days);\n return date;\n}\n\nfunction getDatesBetween(startDate, stopDate) {\n var dateArray = new Array();\n var currentDate = startDate;\n while (currentDate <= stopDate) {\n dateArray.push(new Date (currentDate));\n currentDate = addDays(currentDate, 1);\n }\n return dateArray;\n}\n\nfunction getPagesToProcess() {\n const now = new Date()\n const startDat
@Stvad
Stvad / d.js
Last active August 17, 2021 21:01
delete empty Roam blocks
empty = roamAlphaAPI.q(
'[:find ?uid :where [?x :block/string ?content] [?x :block/uid ?uid] [(clojure.string/blank? ?content)]]')
empty.map(it=>block(it[0])).filter(it=>it.children.length === 0 ).forEach(it=>{
roamAlphaAPI.deleteBlock({block: {uid: it.uid}})
})
@Stvad
Stvad / finance tracking notebook.json
Created August 8, 2021 20:33
Net worth reactive notebook with iRoam
[{"create-time":1628452793788,"title":"finance tracking notebook",":create/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"},"children":[{"edit-time":1628452795552,"children":[{"string":"```javascript\n_ = require('lodash')```","create-time":1628434574298,"uid":"KFNPf1QWU","edit-time":1628452795552,":create/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"},":edit/user":{":user/uid":"6bJAKBYrpIcPZBpFEpexUwW3x5r1"}},{"string":"```javascript\nstate = observe(\"lAzI6D32V\")\n\nfunction deserializeAsset(node) {\n return {\n name: node.text,\n price: parseFloat(node[\"last price\"].attributeValue),\n position: parseFloat(node[\"position\"].attributeValue),\n type: node[\"type\"].attributeValue,\n accessRestricted: node[\"access restricted\"].attributeValue === \"True\",\n value() {\n return this.price*this.position\n }\n }\n}\n\nfunction assetsValue(assets) {\n return assets.map(it=>it.value()).reduce((a,b)=>a+b)\n}\n\nassets = state.children.map(deserializeAsset)```","create-time":16
@Stvad
Stvad / example_breaking1.mdx
Created January 15, 2021 05:39
gatsby 28815

```

import static

@Stvad
Stvad / surfingkeys_config.js
Last active April 20, 2022 04:34
Surfingkeys config
// https://github.com/brookhong/Surfingkeys/wiki/Migrate-your-settings-from-0.9.74-to-1.0
const {
aceVimMap,
mapkey,
imap,
imapkey,
vmap,
getClickableElements,
vmapkey,
map,
@Stvad
Stvad / functiona_cubs.kt
Created August 16, 2018 21:31
Functional cubs Kotlin
object Part1 {
fun captcha(input: String): Int =
input.zipWithNext()
.let { it + (input.first() to input.last()) }
.filter { (first, second) -> first == second}
.map { it.first }
.map(Character::getNumericValue)
.sum()
}
@Stvad
Stvad / lesson6-cat-problem.ipynb
Last active May 7, 2018 19:59
Fast.ai Lesson6 problem with cat model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Stvad
Stvad / Digital_conscience.js
Last active October 2, 2017 18:05
Greasmonkey script to ask you if you really want to access some distracting web resource
// ==UserScript==
// @name Timeout blocker v2
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @match https://www.facebook.com/*
// ==/UserScript==
//--- The @grant directive is used to restore the proper sandbox.