Skip to content

Instantly share code, notes, and snippets.

//
// DraggingValidator.swift
// Stash
//
// Created by Cory Sullivan on 2019-03-09.
// Copyright © 2019 Cory Sullivan. All rights reserved.
//
import Cocoa
@drhisham-code
drhisham-code / clickdrag.swift
Created May 23, 2020 09:12 — forked from jgthms/clickdrag.swift
Click drag mouse to specific position and dimension via command line in Mac OS
#!/usr/bin/env xcrun swift
import Foundation
let firstDelayUSec : useconds_t = 2000_000
let kDelayUSec : useconds_t = 500_000
func DragMouse(from p0: CGPoint, to p1: CGPoint) {
let mouseDown = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseDown, mouseCursorPosition:p0, mouseButton:.left)!
let mouseDrag = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseDragged, mouseCursorPosition:p1, mouseButton:.left)!
let mouseUp = CGEvent.init(mouseEventSource:nil, mouseType:.leftMouseUp, mouseCursorPosition:p1, mouseButton:.left)!
//
// AppDelegate.swift
// test
//
// Created by IOANNIS DELIGIANNIS on 1/2/16.
// Copyright © 2016 IOANNIS DELIGIANNIS. All rights reserved.
//
import Cocoa
@drhisham-code
drhisham-code / karabiner.edn
Created June 3, 2020 00:45
mouse key rmap for double press and layer
{:main [{:des "mb3-layer"
:rules [
;; set the action for double press first
[{:pkey :button3} [:!Sgrave_accent_and_tilde :slash ] ["mb3-q" 1] ]
;; set the variable initializer for single press and allow pass throw?
[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]{:pkey :button3}] nil
{:afterup ["mb3-layer" 0]
:alone {:pkey :button3}
:delayed {:invoked ["mb3-q" 0] :canceled ["mb3-q" 0]}
}]
@drhisham-code
drhisham-code / karabiner.edn
Created June 3, 2020 01:23
mouse karabiner
{:main [{:des "mb3-layer"
:rules [
;; set the action for double press first
[{:pkey :button3} [:!Sgrave_accent_and_tilde :slash ] ["mb3-q" 1] ]
;; set the variable initializer for single press,longpress and allow pass throw on doublepress ?
;;[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]{:pkey :button3}] nil
[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]] nil
{:afterup ["mb3-layer" 0]
:alone {:pkey :button3}
:delayed {:invoked ["mb3-q" 0] :canceled ["mb3-q" 0]}
/*
It's now a package. You can find it here:
https://github.com/joshnuss/svelte-local-storage-store
*/
// Svelte store backed by window.localStorage
// Persists store's data locally

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@drhisham-code
drhisham-code / easings.css
Created July 24, 2020 09:24 — forked from argyleink/easings.css
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@drhisham-code
drhisham-code / auto increment column with header row in google sheets
Created July 29, 2020 19:45
auto increment column with header row in google sheets
= ArrayFormula(
IF(ROW(B:B)=1,"ID",
IF(ISBLANK(B:B),"",
row(B:B)-1
)
)
)
// A:A is the ID column that will autoincrement
// B:B is the adjacent column that is checked for blank
//Assuming that our URL is https://example.com/?product=shirt&color=blue&newuser&size=m,
//we can grab the query string using window.location.search:
const queryString = window.location.search;
// console.log(queryString);
// ?product=shirt&color=blue&newuser&size=m
//We can then parse the query string’s parameters using URLSearchParams:
const urlParams = new URLSearchParams(queryString);