Skip to content

Instantly share code, notes, and snippets.

View flockast's full-sized avatar
🏓

konstantin flockast

🏓
View GitHub Profile
@james2doyle
james2doyle / DynamicIcon.vue
Last active August 24, 2024 19:34
Load an icon dynamically in Vue 3 using the import keyword and a ref
<!--
Icon Component
Usage:
<icon icon="button"></icon>
-->
<template>
<transition name="fade" mode="out-in">
<div v-if="!loadedIcon" class="w-4">&nbsp;</div>
<component :is="loadedIcon" v-else v-once class="icon-wrapper" :name="icon" v-bind="$attrs" v-on="$listeners" />
@cutiko
cutiko / Readme.md
Created November 22, 2019 18:24
Git delete last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

ORIGINAL did fork but search didn't helped me

@arayaryoma
arayaryoma / asyncForEach.ts
Created November 14, 2019 14:53
Frequently used utility functions for TypeScript
const asyncForEach = async <T>(array: T[], callback: (item: T, index?: number) => Promise<unknown>): Promise<void> => {
for (let i = 0; i < array.length; i++) {
await callback(array[i], i);
}
return
};
@loilo
loilo / pass-slots.md
Last active October 16, 2024 18:16
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active December 22, 2024 01:12
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@edmondyip
edmondyip / app.js
Created January 23, 2018 03:04
Convert Hex to RGB in Vue Method
data: {
return {
opacity: 50
}
},
methods: {
convertHex: function (color) {
color = color.replace('#', '')
let r = parseInt(color.substring(0, 2), 16)
let g = parseInt(color.substring(2, 4), 16)
@zmts
zmts / tokens.md
Last active December 17, 2024 21:43
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active December 15, 2024 03:33
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@paulsturgess
paulsturgess / service.js
Last active August 8, 2024 04:25
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE