Skip to content

Instantly share code, notes, and snippets.

View jupegarnica's full-sized avatar
🔍

Garn jupegarnica

🔍
View GitHub Profile
#!/bin/bash
# FILES=./files/*
TARGET=./new # make sure that folder exists!
COUNTER=1 # if you want to start from 0, just put 0 there
for f in $(ls -t files/*)
do
echo "Processing $f file..."
mv -i $f $TARGET/$COUNTER"___"${f##*/}
let "COUNTER++"
version: '3'
services:
strapi:
container_name: strapi
image: strapi/strapi
environment:
- DATABASE_CLIENT=mysql
- DATABASE_HOST=mysql
- DATABASE_PORT=3306
@jupegarnica
jupegarnica / index.html
Last active November 29, 2020 08:59
Truncate the text to the specific number of lines (CSS)
<div class="wrapper">
<div class="line-clamp">
<p>
You can use <code>-webkit-line-clamp</code> property to truncate the text to the specific number of lines.
An ellipsis will be shown at the point where the text is clamped.
</p>
</div>
</div>
.text-gradient {
background: linear-gradient(to right, darkblue, darkorchid);
color: transparent;
background-clip: text;
}
@jupegarnica
jupegarnica / easiest-autogrowing-textarea.markdown
Created November 19, 2020 07:56
Easiest Autogrowing Textarea
@jupegarnica
jupegarnica / tailc
Created November 13, 2020 11:46 — forked from liufuyang/tailc
Color output of linux tail command
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}
function useStickyState(defaultValue, key) {
const [value, setValue] = React.useState(() => {
const stickyValue = window.localStorage.getItem(key);
return stickyValue !== null
? JSON.parse(stickyValue)
: defaultValue;
});
React.useEffect(() => {
window.localStorage.setItem(key, JSON.stringify(value));
}, [key, value]);
@jupegarnica
jupegarnica / grid-full-bleed.css
Last active October 8, 2020 09:01
grid-full-bleed.css
.wrapper {
display: grid;
grid-template-columns:
1fr
min(65ch, 100%)
1fr;
}
.wrapper > * {
grid-column: 2;
}
jobs:
format:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, 'wip')"
@jupegarnica
jupegarnica / regexp_extension.rb
Created August 10, 2020 06:41 — forked from ssaunier/regexp_extension.rb
Create regex patterns insensitive to accented characters
# Copyright: Applidget - 2013
# License: MIT
# Author: Sébastien Saunier (@ssaunier)
#
# Create regex patterns insensitive to accented characters
# Useful when querying a name in MongoDB
# Mapping array source: http://stackoverflow.com/a/228006/197944, with a .gsub("\\x", "\\u00")
class RegexpExtension