Skip to content

Instantly share code, notes, and snippets.

View send2moran's full-sized avatar
🎯
Focusing

Moran Helman send2moran

🎯
Focusing
  • Tel Aviv, Israel
View GitHub Profile
@send2moran
send2moran / xstate.js
Created January 23, 2022 10:08
useInterpret, useService, useSelector
import { useInterpret, useService, useSelector } from '@xstate/react'
const MyMachineService = React.createContext()
const useMyMachineService = () => {
const service = React.useContext(MyMachineService)
if (!service) {
throw new Error(`useMyMachineService() must be used in a child of <MyMachineProvider>`)
}
return service
}
@send2moran
send2moran / debounceMutationObserver.js
Created April 26, 2020 16:03
debounce MutationObserver
const debounce = (func, delay) => {
let debounceTimer;
return function() {
const context = this;
const args = arguments;
clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => func.apply(context, args), delay);
};
};
let summery = { addded: [], removed: [] };
@send2moran
send2moran / machine.js
Created March 21, 2020 16:44
Generated by XState Viz: https://xstate.js.org/viz
const autocompleteMachine = Machine({
id: "autocomplete",
type: "parallel",
context: {
hits: [],
highlightedIndex: null
},
states: {
searchBox: {
@send2moran
send2moran / machine.js
Created March 21, 2020 12:40
Generated by XState Viz: https://xstate.js.org/viz
const autoSaveMachine = Machine({
id: 'autosave',
initial: 'idle',
context: {
value: null,
revId: 0,
errorRetryLevels: [10, 30, 300],
errorRetryLevelIdx: 0,
errorCounter: 0
},
This file has been truncated, but you can view the full file.
[
{
"albumId": 1,
"id": 1,
"title": "accusamus beatae ad facilis cum similique qui sunt",
"url": "https://via.placeholder.com/600/92c952",
"thumbnailUrl": "https://via.placeholder.com/150/92c952"
},
{
@send2moran
send2moran / cloudSettings
Last active May 24, 2021 17:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-24T17:15:16.776Z","extensionVersion":"v3.4.3"}
if(window.safari) {
// YOUTUBE HACKS for ClickToPlugin
var script = "var s = document.createElement('script'); s.textContent = 'if(!/[?&]html5=1/.test(location.search)){";
// Disable SPF
script += "ytspf={};Object.defineProperty(ytspf,\"enabled\",{\"value\":false});";
// Disable HTML5
script += "HTMLMediaElement.prototype.canPlayType=function(){return\"\";};HTMLMediaElement.prototype.nativePlay=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){if(this.className===\"CTPmediaElement\")this.nativePlay();else{this.removeAttribute(\"src\");this.load();}};";
// Disable Flash version checking...
// ... on /watch pages
script += "ytplayer={};Object.defineProperty(ytplayer,\"config\",{\"get\":function(){return ytplayer.$;},\"set\":function($){$.min_version=\"0.0.0\";$.url_v9as2=$.url;ytplayer.$=$;}});";
if(window.safari) {
// YOUTUBE HACKS for ClickToPlugin
var script = "var s = document.createElement('script'); s.textContent = 'if(!/[?&]html5=1/.test(location.search)){";
// Disable SPF
script += "ytspf={};Object.defineProperty(ytspf,\"enabled\",{\"value\":false});";
// Disable HTML5
script += "HTMLMediaElement.prototype.canPlayType=function(){return\"\";};HTMLMediaElement.prototype.nativePlay=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){if(this.className===\"CTPmediaElement\")this.nativePlay();else{this.removeAttribute(\"src\");this.load();}};";
// Disable Flash version checking...
// ... on /watch pages
script += "ytplayer={};Object.defineProperty(ytplayer,\"config\",{\"get\":function(){return ytplayer.$;},\"set\":function($){$.min_version=\"0.0.0\";$.url_v9as2=$.url;ytplayer.$=$;}});";
#EXTM3U
#EXTINF:0,Sport 1HD
http://46.28.50.124:8088/stream/lpdfofd/playlist.m3u8?id=2262&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
#EXTINF:0,Sport 2HD
http://46.28.53.22:8088/stream/mchnfa/playlist.m3u8?id=2357&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
#EXTINF:0,Sport 5HD Live
http://46.28.53.30:8088/stream/ergerg123/playlist.m3u8?id=1976&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
@send2moran
send2moran / mq_all.css
Created November 5, 2015 10:01 — forked from livercake/mq_all.css
Media Queries
/* Smartphones (portrait & landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {