Skip to content

Instantly share code, notes, and snippets.

View dimohamdy's full-sized avatar
🏠
Working from home

Dimo Hamdy dimohamdy

🏠
Working from home
View GitHub Profile
@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active April 26, 2024 12:41
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@kaleksandrov
kaleksandrov / global-protect.sh
Last active April 19, 2024 03:46
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
// I re-typed what I saw in reference 3 below,
// went to Liked videos page on YouTube[1] while logged in,
// pasted that into browser dev tools console (Google Chrome Version 97.0.4692.99 (Official Build) (x86_64)),
// pressed enter, and it seemed to do its thing, for the most part
// (when I refreshed the page, there was still 1 video remaining).
// [1] as of 2022-01-23 that’s at https://www.youtube.com/playlist?list=LL
// context: https://twitter.com/QiaochuYuan/status/1485164256970510340
// references:
@ollieatkinson
ollieatkinson / HTTPStatusCode.swift
Last active April 15, 2024 18:34
HTTP status codes as a Swift enum.
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes.
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes.
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum.
enum HTTPStatusCode: Int, Error {
/// The response class representation of status codes, these get grouped by their first digit.
enum ResponseType {
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.
case informational
@homaily
homaily / gist:8672499
Last active April 15, 2024 05:57
Regex to validate saudi mobile numbers

السلام عليكم ، هذا كود ريجيكس بسيط للتحقق من صحة أرقام الجوالات السعودية ، يقوم الريجيكس بالتحقق من مفتاح الدولة ، مفتاح شركة الإتصالات لضمان صحة النص المدخل .

Hello, this is a simple regex to validate saudi mobile numbers, the code will validate country code, telecome company code and make sure the tested sting is correct .

/^(009665|9665|\+9665|05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$/

Regex Breakdown - شرح الكود

@martin-nearsoft
martin-nearsoft / ThingSpecs.m
Last active April 14, 2024 04:26
Objective-C Unit Testing - Specs
#define EXP_SHORTHAND
#import <Specta/Specta.h> // A light-weight TDD / BDD framework for Objective-C & Cocoa.
#import <Expecta/Expecta.h> // A Matcher Framework for Objective-C/Cocoa
#import <OCMock/OCMock.h> // An Objective-C implementation of mock objects
#import <OCMock/NSInvocation+OCMAdditions.h>
// 'beforeEach' and 'afterEach' are also aliased as 'before' and 'after' respectively.
// 'describe' is also aliased as 'context'.
// 'it' is also aliased as 'example' and 'specify'.
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@SitanHuang
SitanHuang / typeracer.hack.js
Last active April 1, 2024 05:26
Typeracer 100% hack (Version 2 - Aadaptive Mode - Types at minimum speed required to win)
function triggerKeyboardEvent(el, keyCode, type)
{
var eventObj = document.createEventObject ?
document.createEventObject() : document.createEvent("Events");
if(eventObj.initEvent){
eventObj.initEvent(type, true, true);
}
eventObj.keyCode = keyCode;
@dougdiego
dougdiego / MigrateDefaults.swift
Last active March 27, 2024 00:59
Migrate NSUserDefaults to App Groups - Swift
func migrateUserDefaultsToAppGroups() {
// User Defaults - Old
let userDefaults = NSUserDefaults.standardUserDefaults()
// App Groups Default - New
let groupDefaults = NSUserDefaults(suiteName: "group.myGroup")
// Key to track if we migrated
let didMigrateToAppGroups = "DidMigrateToAppGroups"
@joemasilotti
joemasilotti / UI Testing - Mocking Network Data
Last active January 18, 2024 03:35
Xcode UI Testing - How to mock network data
.