I've edited the title question (which appeared far too general and had been in part addressed on ELU before). There are a couple of particular usages involved in these specific examples.
'Is a trick to', like (the probably less informal) 'is a means to', can be followed by a present participial clause:
This imperative is derived from a causal 'law' ... that false
promising is a means to getting ready money
[Online Guide to Ethics and Morality] ... and there are many hits on Google for "is a means to getting / achieving / making ..."
Other nouns are used in similar constructions: 'This is the key to understanding the issue.' There are over 7 million hits on Google for "is the key to understanding the".
.......
[W]hat is a trick to getting the best currency rate?
[Beth Allcock_Daily Express] ... and there are 140 000 hits on Google for "is a trick to getting".
'Is the trick to' is likewise idiomatic; for instance
Magic is the trick to understanding the mind.
[Durham University] (and 8 million hits on Google for "is the trick to").
Though modern analyses come down in favour of 'getting' in 'getting the best currency rate' (for example) being a verb (it does have a complement-or-whotsit now classed as a direct object), 'to' is classed as a preposition here.
..........................
Note that in the same Express article there is:
Brexit news: Currency expert reveals trick to avoid weak pound ...
There are a reasonable number of Google hits for "a trick to avoid having" and "a trick to speed up", over 1 1/2 million for "a trick to get", getting on for (now there's a fuzzy quantifier!) 2 million for "a trick to make" (but I expect a lot of false positives here). I'd class 'a trick to + infinitive' (and close variants like 'some tricks to') as idiomatic, given a sensible verb.
The 'to' here is the 'with the purpose/intended purpose of' [+ ing-form] usage, which I wouldn't class as the infinitive marker. The example given can be analysed as the remnant after deletion of 'On page 21, some tricks for you to speed up your beauty routine', which looks far more like a to-infinitive to usage. Compare '... a tool to extract staples with'.