Skip to content

Instantly share code, notes, and snippets.

View egfx's full-sized avatar
💭
gif.com.ai

Ilya egfx

💭
gif.com.ai
View GitHub Profile
@skymen
skymen / gist:6204aada1ad29a78e1295c1e8fcfb465
Last active December 28, 2023 05:33
Blur Twitter Timeline
// ==UserScript==
// @name Blur Twitter Timeline
// @namespace http://tampermonkey.net/
// @version 2023-12-14
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
@rlingineni
rlingineni / cleaner.js
Last active December 20, 2021 12:48
Converts flat html files into a directory structure with index.html
/**
* Converts a flat file structure like:
* about.html, features.html, blog.html
* into
* features/index.html, about/index.html, blog/index.html
* Usage: node cleaner.js or node cleaner.js watch
*/
const fs = require("fs")
@TaylorBeeston
TaylorBeeston / photoOptimizer.js
Last active July 11, 2022 20:39
Optimize photos client-side
const MAX_WIDTH = process.env.PHOTO_MAX_WIDTH || 800;
const QUALITY = process.env.PHOTO_QUALITY || 0.9;
const readPhoto = async (photo) => {
const canvas = document.createElement('canvas');
const img = document.createElement('img');
// create img element from File object
img.src = await new Promise((resolve) => {
const reader = new FileReader();
let myObj = {
//add an asyncIterator method to my object
[Symbol.asyncIterator]() {
//which will return an object that contains a method called next()
return {
i: 0 /* my counter property */,
next() {
if (this.i < 3) {
//return value from the next method must be an object
//the object should contain a value and a done property
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active April 30, 2024 08:44
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@tobiaswx
tobiaswx / Regex.txt
Last active May 21, 2020 20:40
Regex | Regular Expression to identify YouTube-URLs with video-id match
https://regex101.com/r/l0m7yh/3
Regex: ^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.?be)(\/)?(embed\/)?(watch\?v=|\?v=)?(?<video_id>.*)$
Group 7 / 'video_id' includes the video-id
Testes with examples like:
https://www.youtube.com/watch?v=osz5tVY97dQ
https://youtube.com/watch?v=osz5tVY97dQ
https://youtube.com/osz5tVY97dQ
@rudolph9
rudolph9 / example.js
Created April 26, 2018 00:41
showing awit is not synchronous
class Foo {
constructor(foo) {
this.foo = foo
}
async execUntilStop(callback) {
const timeoutLoopCallback = () => {
if (this.stopExec) return;
callback({ data: 'data' });
setTimeout(timeoutLoopCallback, 10);
@egyjs
egyjs / Direct Link of YouTube videos.md
Last active April 17, 2024 06:38
PHP API To get Direct Link of YouTube videos
var r1 = /(\$|£|€)\d+(k|K)/m
var r2 = /\d+-\d+(k|K)/m
var r3 = /\d+(k|K)\s?(€|EUR)/m
var candidates = [r1, r2, r3];
var linkQueue = []
var comments = document.getElementsByTagName("tr")
for (var i in comments) {
var comment = comments[i];
if (comment.className && comment.className.indexOf("athing comtr") != -1) {