Skip to content

Instantly share code, notes, and snippets.

View omar2205's full-sized avatar
πŸ•

omar2205

πŸ•
View GitHub Profile
@omar2205
omar2205 / convert.ts
Created January 28, 2023 01:28
Convert text to π•Ίπ–‘π–‰π–Š π•°π–“π–Œπ–‘π–Žπ–˜π–
function toOldeEnglish(text: string, is_bold = false) {
const regularUpper = {
A: "𝔄",
B: "𝔅",
C: "β„­",
D: "𝔇",
E: "π”ˆ",
F: "𝔉",
G: "π”Š",
H: "β„Œ",
@omar2205
omar2205 / app.html
Last active February 3, 2023 15:10
i18n svelte type-safe
<html theme="%theme%" lang="%lang%" dir="%dir%">
@omar2205
omar2205 / s1.md
Last active January 27, 2023 04:12
The Raven's Reign

The Raven's Reign: A Sherlock and Watson Adventure

image

Sherlock Holmes sat at his desk, staring intently at the computer screen in front of him. Dr. John Watson, his trusted companion and partner in crime-solving, stood at his shoulder, looking over his shoulder.

"What have you got there, Sherlock?"

"A new case, Watson. One that is most intriguing."

@omar2205
omar2205 / getThumbnails.js
Created January 23, 2023 21:07
Get YouTube video thumbnails
function getThumbnails(videoId) {
const thumbnails = {}
const baseUrl = `https://img.youtube.com/vi/${videoId}/`
thumbnails.maxresdefault = `${baseUrl}maxresdefault.jpg`
thumbnails.hqdefault = `${baseUrl}hqdefault.jpg`
thumbnails.mqdefault = `${baseUrl}mqdefault.jpg`
thumbnails.default = `${baseUrl}default.jpg`
return thumbnails
@omar2205
omar2205 / +page.svelte
Created January 15, 2023 12:03
Update status action - a toggle/switch action to send a form action
<script lang="ts">
import { updatestatus } from '$lib/UpdateStatus'
import type { PageData } from './$types'
export let data: PageData
</script>
{#each data.users as user}
<input
name="status"
@omar2205
omar2205 / open_ports.sh
Created December 4, 2022 22:32
Open ports - iptables
#!/bin/bash
ports_array=(3000 4000 8000 8080)
for port in "${ports_array[@]}"; do
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport "$port" -j ACCEPT
done
sudo netfilter-persistent save
@omar2205
omar2205 / app.ts
Last active November 23, 2022 18:37
Render React with Deno
// Run: deno run -A app.ts
import fast from 'https://deno.land/x/fast/mod.ts'
import * as React from 'https://esm.sh/[email protected]'
import * as ReactDOMServer from 'https://esm.sh/[email protected]/server'
const Home = () => <h1>Hello from React and Deno</h1>
const app = fast()
@omar2205
omar2205 / mkir.vim
Created November 5, 2022 22:46
Vim create a dir if it's doesn't exist
function s:MkNonExDir(file, buf)
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
let dir=fnamemodify(a:file, ':h')
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
endif
endfunction
augroup BWCCreateDir
autocmd!
@omar2205
omar2205 / tmi.min.js
Created October 22, 2022 15:26
tmi.js
!function s(o,i,r){function a(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=i[t]={exports:{}},o[t][0].call(n.exports,function(e){return a(o[t][1][e]||e)},n,n.exports,s,o,i,r)}return i[t].exports}for(var c="function"==typeof require&&require,e=0;e<r.length;e++)a(r[e]);return a}({1:[function(e,t,n){"use strict";e=e("./lib/client");t.exports={client:e,Client:e}},{"./lib/client":3}],2:[function(e,t,n){"use strict";function i(t,e){var n,s=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),s.push.apply(s,n)),s}function u(s){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?i(Object(o),!0).forEach(function(e){var t,n;t=s,e=o[n=e],n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e}):Obje
@omar2205
omar2205 / share.ts
Created October 21, 2022 18:52
navigator share API
const shareData = {
title: 'GOOGLE',
text: 'Search with google',
url: 'https://google.com/'
}
const share = async () => {
try {
await navigator.share(shareData)
console.log('Shared successfully')