Skip to content

Instantly share code, notes, and snippets.

View somidad's full-sized avatar

Seokseong Jeon somidad

  • Samsung Electronics
  • Korea, Republic Of
View GitHub Profile
@somidad
somidad / obsidian-code-block-scroll.css
Last active March 21, 2024 23:30
Stop Obsidian wrapping code and enable scrolling
/* same article on [dev.to](https://dev.to/somidad/stop-obsidian-wrapping-code-and-enable-scrolling-47oo) */
/* it only works on Reading view */
/* https://forum.obsidian.md/t/horizontal-scrolling-in-the-code-block/55789/2 */
.markdown-rendered code {
white-space: pre;
}
@somidad
somidad / README.md
Last active March 21, 2024 13:13
Enable a link to a block in a note using Obsidian GitHub Publisher

Same article on dev.to

TL;DR

Here's my configuraiton (in data.json):

    "censorText": [
      {
 "entry": "/ (\\^\\w+)$/gm",
@somidad
somidad / README.md
Last active March 20, 2024 15:05
GitHub adds `user-content-` prefix to custom ID
@somidad
somidad / file-saver.jsx
Last active November 6, 2023 12:47
Simple FileSaver.js (https://www.npmjs.com/package/file-saver) example
import { saveAs } from "file-saver";
function DownloadContent() {
const download = () => {
const blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello, world.txt");
}
return (
<button onClick={download}>Download</button>
)
@somidad
somidad / logseq-distinct-foreground-color.css
Last active September 20, 2023 15:01
Logseq: Make page ref, block ref, tag and marker look more distinct
/* Yello hyperlink on green background */
.page-ref {
color: #E0D772;
}
/* Yellow underline on green background */
.block-ref {
border-bottom-color: #E0D772;
}
@somidad
somidad / logseq-distinct-left-sidebar-nav-header.css
Created August 18, 2023 01:55
Logseq: Make nav header on left sidebar more distinct
/* Make nav header on left sidebar more distinct */
.left-sidebar-inner .nav-content-item .header {
background-color: var(--ls-tertiary-background-color);
}
@somidad
somidad / read-file.jsx
Created June 7, 2023 14:20
Read a file on React
function Component() {
const onChange = (e) => {
const file = e.target.files?.[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.addEventListener('load', () => {
console.log(reader.result);
});
@somidad
somidad / publish-logseq.yml
Last active June 28, 2023 12:37
Deprecated. See logseq/publish-spa. GitHub workflow to publish a Logseq graph to GitHub Pages
name: Publish
on:
#push:
#branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
@somidad
somidad / logseq-publish-github-pages-wa.js
Last active June 25, 2022 07:54
Script to remove U+2029 from published Logseq graph for GitHub Pages
const { readFileSync, writeFileSync } = require("fs");
function indexOfUnicode(s, u) {
let i = -1;
for (i = 0; i < s.length; i++) {
if (s.charCodeAt(i) === u) {
break;
}
}
return i;
@somidad
somidad / workflow.yml
Last active June 23, 2023 14:06
GitHub Workflow to check any change on git repository and do something if any
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
- name: Check if there is any change
id: get_changes
# deprecated. see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
#run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
- name: Do something if there is any change
if: steps.get_changes.outputs.changed != 0
run: do something