Skip to content

Instantly share code, notes, and snippets.

View logicaroma's full-sized avatar

Ramin Mohammadi logicaroma

View GitHub Profile
const primaryColumn = document.querySelector('div[data-testid="primaryColumn"]');
document.body.innerHTML = '';
document.body.append(primaryColumn);
// Per-tweet controls
for (const ele of document.querySelectorAll('div[role="group"]')) {
ele.remove();
}
// Reply widget
// Batch-delete videos from YouTube’s “Watch later” playlist
// Paste the following code into a browser console while the playlist is open
// Code based on: https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f?permalink_comment_id=4087416#gistcomment-4087416
//
// (Suggestions for improvement welcome. My approach for waiting for the .click() to finish, feels hacky.)
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function remove() {
for (let i=0; i < 100; i++) {
document.querySelector('#primary button[aria-label="Action menu"]').click();

My writing process

Stages of my writing process

  • Collecting material: For a number of topics that I may write about in the future, I have text files where I collect information as I come across it during coding, on the web, on Twitter, etc.

  • Outline: The collected material is my starting point. I rearrange it into an outline which I refine until I’m happy with it. Refining includes adding/removing/rearranging items and doing more research when I notice gaps in my knowledge.

  • Skeletal draft: I add bullet points and code examples until almost all of the content exists at least in skeletal form. This process often uncovers knowledge gaps and flaws in the structure of the content which I then can fix.

@kaung8khant
kaung8khant / App.js
Last active June 7, 2023 15:18
Lazy Loading with React, GraphQL and Formik (Phone number input - country code with flag)
import React from "react";
import { gql } from "apollo-boost";
import { Form,Dropdown } from "semantic-ui-react";
import PhonePrefix from "PhonePrefix";
//use graphql for api call
const COUNTRY_QUERY = gql`
{
countries {
id
@StefanNieuwenhuis
StefanNieuwenhuis / reactiveconf-framework-independent-components-library-with-StencilJS.md
Last active September 23, 2020 12:55
How to build a framework independent component library with StencilJS

How to build a framework independent component library with StencilJS

This is a proposal for a lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal! If you're on your phone, please request the 🖥 desktop site to star this gist 😇 #ReactiveConf

@ThomasBurleson
ThomasBurleson / untilDestroyed.ts
Last active April 18, 2023 07:47
Using untilViewDestroyed to link component ngOnDestroy to observable unsubscribe.
/**
* When manually subscribing to an observable in a view component, developers are traditionally required
* to unsubscribe during ngOnDestroy. This utility method auto-configures and manages that relationship
* by watching the DOM with a MutationObserver and internally using the takeUntil RxJS operator.
*
* Angular 7 has stricter enforcements and throws errors with monkey-patching of view component life-cycle methods.
* Here is an updated version that uses MutationObserver to accomplish the same goal.
*
* @code
*
@kevinpschaaf
kevinpschaaf / 0. Custom Elements + Redux toolbox & examples.md
Last active July 21, 2020 06:48
Custom Elements + Redux toolbox & examples

An approach to binding Redux to custom elements

The code here captures some of the patterns I used in the "real estate" demo app discussed in my talk End to End Apps with Polymer from Polymer Summit 2017.

There are many ways to connect Redux to custom elements, and this demonstrates just one pattern. The most important aspects are to try and lazily-load as much of the otherwise global state management logic along with the components that need them (as shown via the lazyReducerEnhancer and addReducers calls in the connected components), and to consider the tradeoffs you make in terms of coupling components to the store.

The pattern shown here of creating a stateless component and then a subclass that connects it to the store addresses a potential desire to reuse app-level stateless components between more than one application context, so the subclass provides a degree of decoupling from the concrete store, at the expense of more boilerplate. If app com

@baydam
baydam / build-pocketvj.md
Last active November 4, 2024 00:13
How to build PocketVJ on Raspberry Pi 3

Documentation for building PocketVJ on raspberry Pi 3

Install Raspbian Lite

Find the instruction in the link below https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Install dependencies

$ sudo apt-get -y install lxde-core lxterminal lxappearance xinit lightdm ntfs-3g python-pexpect vim figlet git-core firmware-ralink hostapd isc-dhcp-server lighttpd samba samba-common-bin php5-common php5-cgi php5 php5-mysql screen fbi ttf-mscorefonts-installer mediainfo gparted php5-cli iptables xtightvncviewer imagemagick dosfstools exfat-utils exfat-fuse hfsplus hfsprogs hfsutils xdotool expect expect-dev avahi-daemon libavahi-compat-libdnssd-dev feh libjpeg8 libjpeg8-dev libao-dev avahi-utils libavahi-compat-libdnssd-dev libva-dev youtube-dl python-smbus mpg321 mpg123 libreoffice-impress rc-gui python-pip iceweasel python-dev python-dbus xpdf x11-xserver-utils libncurses5-dev shellinabox tk okular usbmount libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstr
@bahmutov
bahmutov / Docker shell commands.sh
Last active February 9, 2024 07:55
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@axemclion
axemclion / chrome-selenium-timeline.js
Created September 19, 2015 04:06
Getting Chrome timeline from Selenium Log
var wd = require('wd');
// This is for Chromedriver directly.
// If you are using Selenium, use http://localhost:4444/wd/hub
var browser = wd.promiseRemote('http://localhost:9515');
var URL = 'http://islreview.com/'; // Change this to a custom URL
var config = {
"browserName": "chrome",
"chromeOptions": {