Skip to content

Instantly share code, notes, and snippets.

@claudioluciano
claudioluciano / spoiler_obsidian.css
Created April 10, 2024 18:07
Obsidian - snippet to create spoilers on notes
.cm-active[data-task="#"] * {
display: initial;
}
.cm-active[data-task="#"]>label {
display: none
}
[data-task="#"]>* {
display: none;

Keybase proof

I hereby claim:

  • I am claudioluciano on github.
  • I am claudioluciano (https://keybase.io/claudioluciano) on keybase.
  • I have a public key ASAVuW-EK3r_sa7rI1JzlJHHP35aOKmTkzvZrCsoC8SVfQo

To claim this, I am signing this object:

@claudioluciano
claudioluciano / tag_increment.sh
Created August 9, 2023 14:42
List all tags and increment the version in a repo with tags for packages
# This code will get the latest tag for a package and increment it by one.
# The function get_latest_tags will get all the tags for a package
# The function get_latest_tag_for_package will get the latest tag for a package
# Then the latest tag will be incremented by one using awk and sed
#!/bin/bash
get_latest_tags() {
git for-each-ref --sort=-taggerdate --format '%(refname:short)' refs/tags/*/**
}
@claudioluciano
claudioluciano / opera_codec.sh
Created September 14, 2020 18:30
Opera codec for videos :D
#!/bin/bash
mkdir -p codecs
cd codecs
wget https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.39.2/0.39.2-linux-x64.zip
unzip 0.39.2-linux-x64.zip
sudo rm -f /usr/lib/x86_64-linux-gnu/opera/*.bak
sudo mv /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so.bak
sudo cp libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/
cd ..
#!/bin/ash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
# Syntax: ./common-alpine.sh <install zsh flag> <username> <user UID> <user GID>
USERNAME=$1
USER_UID=$2
@claudioluciano
claudioluciano / router.ex
Created March 11, 2020 16:57 — forked from renanvalentin/router.ex
Plug unit testing
defmodule LearningElixir.Router do
use Plug.Router
if Mix.env == :dev do
use Plug.Debugger
end
plug :match
plug :dispatch
//https://github.com/nestjs/nest/issues/986
const tsConfig = require('./tsconfig.json');
const tsConfigPaths = require('tsconfig-paths');
const paths = tsConfig.compilerOptions.paths;
tsConfigPaths.register({
baseUrl: tsConfig.compilerOptions.outDir,
paths: Object.keys(paths).reduce(
@claudioluciano
claudioluciano / cursor.js
Created September 5, 2019 03:27
Persisting the changes of range objects after selection in HTML
/// https://stackoverflow.com/a/13950376
/// http://jsfiddle.net/WeWy7/3/
export function saveSelection (containerEl) {
if (window.getSelection && document.createRange) {
const range = window.getSelection().getRangeAt(0)
const preSelectionRange = range.cloneRange()
preSelectionRange.selectNodeContents(containerEl)
preSelectionRange.setEnd(range.startContainer, range.startOffset)
const start = preSelectionRange.toString().length
@claudioluciano
claudioluciano / persistedstate.js
Last active April 10, 2019 12:48
Workaround to persist state across server and client together ( NUXT && vuex-persistedstate)
//https://github.com/nuxt/nuxt.js/issues/972#issuecomment-372223633
//for anyone needing a workaround to persist state across server and client together
//plugins/persistedstate.js
import createPersistedState from 'vuex-persistedstate'
import * as Cookies from 'js-cookie'
import cookie from 'cookie'
export default ({store, req, isDev}) => {