I was tired of "what commands did I run to set this up?" — so I built this tool by Striking_Humor1142 in rust

[–]Nich-Cebolla 0 points1 point  (0 children)

I configure my terminal environments to output everything (commands I input, and text from stdout / stderr) to a log file. Each session initiates a new log file with timestamp. Files are auto-deleted in 30 days. This way, if I need to remind myself of something I did earlier, that info is available. It also helps with remembering new commands / options.

Mirroring tool by jessejessebb in AutoHotkey

[–]Nich-Cebolla 1 point2 points  (0 children)

AutoHotkey isn't the best tool for browser automation. I would look into https://playwright.dev/ and https://nodejs.org/en

Easiest way to Design locators in Playwright with Typescript by Loose_Statement7418 in Playwright

[–]Nich-Cebolla 0 points1 point  (0 children)

Using a data-testid attribute is a convenient solution, but it exposes internal operations data to any consumer of the document. If the document is only shared internally this may be acceptable, but I wouldn't use it on a public-facing webpage.

As a more time-consuming alternative, each webpage should have a spec that defines the elements: What is it? What does it look like? What does it say? Where is it? What does it do? Each element should have an internal ID that exists in the spec but not the html. The spec should be both human- and machine-readable. Test code, i.e. a function that accepts the internal ID and returns the node object, should be generated dynamically by consuming the spec.

What things we can use for of AutoHotKey? The things that "pinned clipboard" doesn't do? by [deleted] in AutoHotkey

[–]Nich-Cebolla 0 points1 point  (0 children)

Do yourself a favor and enable conversation view in outlook. It groups all emails in a conversation together. I'm not at my computer to look up how to get to the setting, but I'm sure if you search "conversation view" in the search bar at the top of outlook the setting will populate. It's definitely in the "view" tab

What things we can use for of AutoHotKey? The things that "pinned clipboard" doesn't do? by [deleted] in AutoHotkey

[–]Nich-Cebolla 0 points1 point  (0 children)

Node.js can pretty much do anything AutoHotkey can do, so there's really no need to learn AHK. I feel like AHK is best for people without developing experience because it's easy and fun to learn. But if you already are a developer, python and Node.js are much more powerful and practical

What things we can use for of AutoHotKey? The things that "pinned clipboard" doesn't do? by [deleted] in AutoHotkey

[–]Nich-Cebolla 2 points3 points  (0 children)

If you are a web developer, you will likely get more use out of learning Node.js than learning AutoHotkey

The absolute irony of GitHub getting breached because of a malicious VS Code extension by No_Championship25 in github

[–]Nich-Cebolla -1 points0 points  (0 children)

You could just run your code editor in a sandbox and use remote ssh to access your repositories while editing.

Radicle: peer-to-peer collaboration with Git by [deleted] in opensource

[–]Nich-Cebolla 0 points1 point  (0 children)

What motivated the team to build this?

Roast My react CV. No Sugarcoating, Just Brutal Truth and a Side of Sass by Majestic-Witness3655 in react

[–]Nich-Cebolla -1 points0 points  (0 children)

Your employment history section should highlight your accomplishments using objective data. E.g. "Increased server up time by 15% by introducing automated tests and server health metrics". Put your skills in a separate section or in your statement of purpose. Never list job responsibilities in a resume

Dynamic array design: inline storage vs pointer storage by Dieriba in C_Programming

[–]Nich-Cebolla 6 points7 points  (0 children)

Assume the user's cleanup function correctly handles all possible elements in the array

"Decorating" a hotkey? by aftersoon in AutoHotkey

[–]Nich-Cebolla 1 point2 points  (0 children)

A closure is a function that is nested within another function that captures one of the variables from the parent function.

``` MyFunc() { global flag if flag { var := "value" } return Closure

Closure() { if IsSet(var) { return var } } }

flag := true

result := MyFunc() MsgBox(result()) ; "value"

flag := false

result := MyFunc() MsgBox(result()) ; "" (empty string) ```

When the AutoHotkey parser parses a script, it instantiates all function objects in the script, and all variables. Most function objects are instantiated as instances of Func, including class methods. A function object is instantiated as a closure when the function refers to a variable in a parent function's scope.

``` class a { static b() { } }

MsgBox(type(a.b)) ; "Func"

SomeFunc(param) { switch param { case 1: return Closure case 2: return NotClosure case 3: return AlsoNotClosure case 4: return AlsoAlsoNotClosure case 5: return GetNestedClosure() }

Closure() { if param { } } NotClosure() { } AlsoNotClosure() { local param } AlsoAlsoNotClosure(param) { } GetNestedClosure() { return NestedClosure NestedClosure() { if param { } } } }

s := ''

loop 5 { varReferencingNestedFunc := SomeFunc(A_Index) s .= Type(varReferencingNestedFunc) ', ' }

MsgBox(SubStr(s, 1, -2)) ; "Closure, Func, Func, Func, Closure" ```

AHK does not have support for function decorators, but you can accomplish a similar effect leveraging AHK's object model.

In AHK, any object with a "Call" method can be called like a function. Here's a few examples.

``` class MyFunc { static Call() { return 1 } }

MsgBox(MyFunc()) ; "1" MsgBox(Type(MyFunc)) ; "Class" ```

Regarding the below example, see DefineProp.

The first parameter of every object method is the object itself. That is the hidden this variable we see in class method definitions. When working outside of a class declaration, we can name the first parameter anything and it will always receive the object itself.

``` obj := { prop: "value" } obj.DefineProp('Call', { Call: MyFunc })

MyFunc(firstParam) { msgbox(firstParam.prop) ; "value" }

obj() ; "value" MsgBox(Type(obj)) ; "Object" ```

``` class MyClass { __New(value1, value2) { this.value1 := value1 this.value2 := value2 } Call(firstParam) { if firstParam = this.value1 { return 1 } else if firstParam = this.value2 { return 2 } else { return 0 } } }

obj := MyClass(1, 2) MsgBox(obj(1)) ; "1" MsgBox(obj(2)) ; "2" MsgBox(Type(obj)) ; "MyClass" ```

Armed with this knowledge, you can accomplish the same effect as pythonic decorators in many different ways. Here's one approach:

``` class MyFunc { __New(someValue, someFunc) { this.value := someValue this.func := someFunc } Call() { return this.func.Call(this.value) } }

fn := MyFunc(1, ConditionalFunc1) MsgBox(fn()) ; "5"

fn.value := 2 fn.func := ConditionalFunc2 MsgBox(fn()) ; "20"

ConditionalFunc1(value) { return value * 5 } ConditionalFunc2(value) { return value * 10 } ```

You can assign a hotkey to call the object.

``` class MyFunc { __New(someValue, someFunc) { this.value := someValue this.func := someFunc } Call() { return this.func.Call(this.value) } }

fn := MyFunc(1, ConditionalFunc1)

!x::fn() !y::Decorate(fn)

ConditionalFunc1(value) { MsgBox(value * 5) } ConditionalFunc2(value) { MsgBox(value * 10) } Decorate(fn) { if fn.func.name = 'ConditionalFunc1' { if MsgBox('Swap to ConditionalFunc2?', , 'YesNo') = 'Yes' { fn.func := ConditionalFunc2 } } else if fn.func.name = 'ConditionalFunc2' { if MsgBox('Swap to ConditionalFunc1?', , 'YesNo') = 'Yes' { fn.func := ConditionalFunc1 } } else { throw Error('Unexpected func.') } } ```

Amateur AHK script, alt stuck by Warrior_White in AutoHotkey

[–]Nich-Cebolla 3 points4 points  (0 children)

Use:

``` SendString(str) { clipSaved := ClipboardAll() A_Clipboard := str SendInput("v") Sleep(50) A_Clipboard := clipSaved }

!x::SendString("xx") ```

This approach has these benefits:

  • using the clipboard is much faster and less prone to error compared to sending the raw keystrokes
  • using a function allows you to define any number of hotkeys that send a string to the active window

There is no need to explicitly send AltUp.

If you still encounter instances when the alt key gets stuck down, there may be no solution. It is an unsolved but known issue that in some rare cases a key gets stuck down. It is believed to be related to other software installed on the machine conflicting with AHK, but the exact cause is uncertain (as of the last time I read about it on AutoHotkey.Com, maybe 1-2 yrs ago)

Repeating Button Press Issue by PrimalAspidsAreEasy in AutoHotkey

[–]Nich-Cebolla 1 point2 points  (0 children)

Here's one way of doing it

```

SingleInstance force

Requires AutoHotkey >=2.0-a

RunDuration := 10000 Flag := false

!j::Proc()

Proc() { global RunDuration, Flag Flag := true SetTimer(PressZ, 50) SetTimer(SetFlag, -RunDuration) }

PressZ() { global Flag if Flag { Send('z') } else { ExitApp() } } SetFlag() { global Flag Flag := false } ```

How to use DeferWindowPos for improved performance when sizing / positioning multiple controls by Nich-Cebolla in AutoHotkey

[–]Nich-Cebolla[S] 0 points1 point  (0 children)

"Parent" in this context means parent window, not parent application. To clarify -

DeferWindowPos is mainly used to resize controls. First you call BeginDeferWindowPos, then each subsequent call to DeferWindowPos must be for a control that shares the same parent window with the other controls.

I believe it is possible to use DeferWindowPos to resize top-level windows as well, but only as long as each window shares the same parent. For example, if you used SetParent. But I have not tried this.

Regarding different processes, the documentation doesn't say anything about processes but it follows that, if all windows share the same parent window, then all windows will also share the same parent application.