Skip to content

Instantly share code, notes, and snippets.

View alexander-mart's full-sized avatar
💭
☮️

Alexander Mart alexander-mart

💭
☮️
View GitHub Profile
#!/bin/bash
# Connect to TerminusDB and dump all data (RDF-triplets) to local file
# https://gist.github.com/alexander-mart/ff1c896f55e5cc7774e922e3f977961b
# Access the TerminusDB CLI from the Docker Compose:
# https://terminusdb.com/docs/install-terminusdb-as-a-docker-container/#usingthecli
# TerminusDB dump command:
# https://terminusdb.com/docs/terminusdb-cli-commands/#triplesdump
@ggondim
ggondim / BuildTree.ts
Created January 18, 2022 00:03
Build a object tree (parent/children) given an object array of type T, the object ID key (elementKey) and the object parent key (parentKey)
type TreeItem<T> = T & { children: TreeItem<T>[] };
export default function buildTree<T>(array: T[], elementKey: keyof T, parentKey: keyof T): TreeItem<T>[] {
let tree = [] as TreeItem<T>[];
for (let i = 0; i < array.length; i++) {
if (array[i][parentKey]) {
let parent = array.filter(elem => elem[elementKey] === array[i][parentKey]).pop() as TreeItem<T>;
if (!parent['children']) {
parent.children = [];
}
@RobertFischer
RobertFischer / Description.md
Last active October 14, 2023 16:47
Benchmarking is Hard, Yo.

So, I was reading Why You shouldn’t use lodash anymore and use pure JavaScript instead, because once upon a time, I shifted from Underscore to Lodash, and I'm always on the lookout for the bestest JavaScript stdlib. At the same time, there was recently an interesting conversation on Twitter about how some of React's functionality can be easily implemented in modern vanilla JS. The code that came out of that was elegant and impressive, and so I have taken that as a message to ask if we really need the framework.

Unfortunately, it didn't start out well. After copy-pasting the ~100 lines of code that Lodash executes to perform a find, there was then this shocking claim: Lodash takes 140ms, and native find takes 0ms.

@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active May 25, 2024 09:02
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@eyecatchup
eyecatchup / hosts
Last active July 12, 2023 08:53
Disable Skype ads: 1.) Add hosts to your hosts file 2.) Flush DNS resolver cache (ipconfig /flushdns)
# Block Skype ads
127.0.0.1 *.msads.net
127.0.0.1 *.msecn.net
127.0.0.1 *.rad.msn.com
127.0.0.1 a.ads2.msads.net
127.0.0.1 ac3.msn.com
127.0.0.1 ad.doubleclick.net
127.0.0.1 adnexus.net
127.0.0.1 adnxs.com
127.0.0.1 ads1.msn.com
@aminin
aminin / git.md
Last active October 30, 2019 21:48
RTFM по Git. Отрыл в старых записях.

Правила работы с Git

Источники

Имена и адреса авторов правок

@Zodiac1978
Zodiac1978 / .htaccess
Last active March 15, 2024 08:29
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/