Skip to content

Instantly share code, notes, and snippets.

View Mosharush's full-sized avatar
👨‍💻
Code. Sleep. Repeat.

Moshe Harush Mosharush

👨‍💻
Code. Sleep. Repeat.
  • Startup Booster
  • Tel Aviv, Israel
  • 12:06 (UTC +03:00)
View GitHub Profile
@Mosharush
Mosharush / bookmark-url.js
Created February 25, 2024 10:06
Bookmark: Conver JIRA Ticket to branch name
javascript: window._ticketDesc = document.querySelector('h1[data-testid="issue.views.issue-base.foundation.summary.heading"]').innerText.split('-')[0].trim().toLowerCase().replaceAll(' ', '-'); window._ticketId = document.querySelector('div[data-testid="issue.views.issue-base.foundation.breadcrumbs.breadcrumb-current-issue-container"]').innerText.toLowerCase(); alert(`${window._ticketId}/` + `${window._ticketDesc}`.replace(/(\-|\:)+$/mg, '').replace(/[\W_]+/mg, '-').substr(0,30));
@Mosharush
Mosharush / README.MD
Last active January 31, 2024 12:25
React Hook - Server-Sent Events (SSE)

Server-Sent Events (SSE) are commonly used in real-time applications where the server needs to push updates to the client.

Here are a few use cases:

  1. Real-time notifications: SSE can be used to push notifications to the client in real-time. For example, in a social media application, the server can push notifications about new posts, likes, comments, etc.
  2. Live news updates: In a news application, the server can push live news updates to the client.
  3. Real-time analytics: In an analytics dashboard, the server can push real-time data updates to the client.
  4. Chat applications: In a chat application, the server can push new messages to the client in real-time.
  5. Online multiplayer games: In an online multiplayer game, the server can push game state updates to the client in real-time.
  6. Stock price updates: In a stock trading application, the server can push real-time stock price updates to the client.
@Mosharush
Mosharush / .bashrc
Last active October 6, 2023 16:43
Bash Alias to run last wrong command wrote in Hebrew to the correct command :)
alias גררר="replace_hebrew_with_latin"
replace_hebrew_with_latin() {
previous_command=$(history | tail -n 1 | sed 's/^[ ]*[0-9]*[ ]*//')
latin_command=$(echo "$previous_command" | tr 'פםןוטארק׳/ףךלחיעכגדשץתצמנהבסז' 'poiuytrewq;lkjhgfdsa.,mnbvcxz')
# Display the translated command
echo "Translated Command: $latin_command"
# Ask for confirmation before executing
echo "Do you want to execute this command? [Press Enter again]"
@Mosharush
Mosharush / getClosestVueInstance.func.js
Last active June 22, 2023 19:30
Function to get closest vue instance from DOM element
export function getClosestVueInstance (elm) {
if (!elm) return;
const parentNode = elm.parentNode;
const vueInstance = parentNode?.__vue__;
return vueInstance ?? getClosestVueInstance(parentNode);
}
@Mosharush
Mosharush / README.MD
Created January 10, 2021 22:18
Tizen Browser - Samsung TV - Remote controll event codes javascript

Event codes

Remote Key Event Code
A 403
B 404
C 405
D 406
INFO 457
TTX/MIX 10200
0 - 9 48 - 57
@Mosharush
Mosharush / README.md
Last active August 28, 2022 11:58
Check if the delivery status is online on a specific restaurant in Wolt

Pre-installation requirements

MacOs:

HomeBrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Linux

espeak (text-to-speak engine)

sudo apt install espeak
@Mosharush
Mosharush / example.html
Created May 5, 2020 16:38
RTL-LTR Both support css design - Scss Mixins
<div class="item"></div>
<style lang="scss">
.item {
position: relative;
@include padding_right_rtl(5px);
@include rtl('right', 0, 0, 'left')
}
</style>
@Mosharush
Mosharush / BaseIcon.vue
Last active July 7, 2021 17:36
Vue BaseIcon component - integrate with IcoMoon App
<template>
<i class="base-icon" :class="iconClass" :style="iconStyle">
<i v-for="n in paths" :class="`path${n}`" :key="icon + n"></i>
</i>
</template>
<script>
import './icons/style.scss'
import icons from './icons.json'
@Mosharush
Mosharush / tsconfig.js
Created December 19, 2019 20:09
TypeScript config example
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"outDir": "build",
"allowJs": true,
"target": "es2015",
"sourceMap": true,
@Mosharush
Mosharush / auto-placeholder-images.php
Created October 17, 2019 10:40
This plugin resolve broken layout when we work on local machine without all uploaded images up to date. Will replace the images with image placeholder via placeholder.com
<?php
/**
* @package Auto_Placeholder_Images
* @version 1.0.0
*/
/*
Plugin Name: Auto Placeholder For Broken Images
Plugin URI: https://www.webstorm.co.il/css-live-reload/
Description: **FOR DEV USE ONLY** This plugin resolve broken layout when we work on local machine without all uploaded images up to date. Will replace the images with image placeholder via placeholder.com
Author: Moshe Harush