Skip to content

Instantly share code, notes, and snippets.

@tmslnz
tmslnz / HTTrack.md
Last active February 19, 2024 03:07
Nice command line for HTTrack

Commands

httrack example.com -O ./example.com -N100 −%i0 -I0 --max-rate 0 --disable-security-limits --near -v
httrack example.com -O ./example.com-3 -N100 -I0 -N "%p/%n%[month].%t" --max-rate 0 --disable-security-limits --near  -v
@tmslnz
tmslnz / aerender.exe wrapper.ps1
Last active June 1, 2023 11:25
PowerShell wrapper for After Effects aerender.exe
<#
After Effects aerender.exe wrapper script
#>
[CmdletBinding(PositionalBinding = $false)]
param(
[String][parameter(Position=0)]$project_pparam,
[String]$project,
[String]$comp = "Main",
[string]$resolution = "Full",
@tmslnz
tmslnz / dnsmasq.md
Last active March 20, 2023 07:07
Setting up dnsmasq on OS X

Install dnsmasq

Via brew or other method

Set up DNS resolver order

In order to work on every connection and on any TLD, dnsmasq needs to be the first DNS resolver receving the query.

And since dnsmasq is a local process, all DNS queries need to go to 127.0.0.1

On macOS, /etc/resolv.conf is automaticaly created, depending on a variety of things (network settings, etc), so it cannot be edited.

@tmslnz
tmslnz / Tx.js
Last active November 6, 2021 01:10
Transform stack
/*
Utility to create and manage a stack of CSS transforms.
Supports namespaced properties.
Example:
var el = document.querySelector('#id');
var tx = new Tx();
Basic usage:
@tmslnz
tmslnz / gulpfile.js
Last active October 26, 2021 02:30
Complete example gulpfile.js for https://github.com/tmslnz/gulp-shopify-theme
/*
Streamlined Shopify theme development.
NOTE: depends on module gulp-shopify-theme
npm install --save-dev yargs gulp gulp-sass gulp-changed gulp-sourcemaps gulp-autoprefixer gulp-uglify gulp-concat gulp-replace gulp-plumber gulp-babel browser-sync gulp-if del gulp-add-src gulp-rename gulp-yaml gulp-shopify-theme
Highlights:
- https proxying via BrowserSync
@tmslnz
tmslnz / getTranslate3d.js
Created February 25, 2017 15:03
Get and array of translate3d values
function getTranslate3d (el) {
var values = el.style.transform.split(/\w+\(|\);?/);
if (!values[1] || !values[1].length) {
return [];
}
return values[1].split(/,\s?/g);
}
server {
server_name "~^((?<subdomain>www)\.)?(?<domain>location\.com)$";
index index.php index.htm index.html default.asp;
## Performs 301 redirects to non-www plus other minor things.
#include templates/server.main.conf;
# ----------------------------------------------------------------------->
# set main domain root to _
if ($subdomain = "") {
@tmslnz
tmslnz / apple-system-font.css
Created July 12, 2015 18:01
Specify Apple System Font in CSS
/* From http://furbo.org/2015/07/09/i-left-my-system-fonts-in-san-francisco/ */
* { font-family: -apple-system-font, HelveticaNeue, LucidaGrande; }
/* Dynamic Type feature */
* { font-family: -apple-system-headline1, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-headline2, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-body, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-subheadline1, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-subheadline2, HelveticaNeue, LucidaGrande; }
@tmslnz
tmslnz / getTransforms.js
Created February 25, 2017 15:02
Get list of transform props
function getTransforms (el) {
var values = [];
var re = /\w+\(.+?\)/gi;
var match = [];
while ((match = re.exec(el.style.transform)) !== null) {
values.push(match[0]);
}
return values;
}
@tmslnz
tmslnz / getOffsetFromParent.js
Created February 25, 2017 15:01
Get HTMLElement offset relative to offsetParent, minus transforms
function getOffset (node) {
var doc = node.ownerDocument;
var docElem = doc.documentElement;
var win = doc.defaultView;
var rect;
var result;
try {
rect = node.getBoundingClientRect();
} catch (e) {
return { left: 0, top: 0 };