This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for img in <path/to/images>/*<.extension>; do noext="${img%.*}"; other=<path/to/thumb>/"${noext#*/}".<other-extension>; convert -resize 300x "$img" "$other" ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs::File; | |
use std::io; | |
use std::io::prelude::*; | |
use std::io::BufReader; | |
fn main() { | |
let s = match read_as_string("<path/to/file>".to_string()) { | |
Ok(content) => content, | |
Err(e) => format!("{:?}", e), | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="author" content=""> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var centerTextAlign = function($elem) { | |
if ($elem.tagName != 'text') return false; | |
var bb=$elem.getBBox(); | |
var x0=bb.x,y0=bb.y; | |
$elem.style.setProperty('text-align', 'center'); | |
$elem.style.setProperty('text-anchor', 'middle'); | |
bb=$elem.getBBox(); | |
var x1=bb.x,y1=bb.y; | |
// position changed because of alignment alteration | |
var offset = x0 - x1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var replaceTextNode = function($parent, txt) { | |
// has a textPath? | |
var $textPath = $parent.getElementsByTagName('textPath'); | |
if ($textPath) $textPath = $textPath[0]; | |
// clean off | |
while ($parent.hasChildNodes()) | |
$parent.removeChild($parent.lastChild); | |
// white space off | |
txt = txt.trim(); | |
// get array of lines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$img = document.querySelector('image:nth-of-type(2)') | |
$svg = document.querySelector('svg') | |
k = 2.5 | |
bb = $img.getBBox() | |
x = bb.x + bb.width/2 | |
x *= (1-k) | |
y = bb.y + bb.height/2 | |
y *= (1-k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
out='' | |
src='' | |
document.querySelectorAll('img[class^=rg_i]').forEach(x=>{ | |
src=x.dataset.src??x.dataset.iurl??x.src??'none' | |
if (src === 'none') { | |
console.log(x) | |
return | |
} | |
out+=src+"\n" | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#box { | |
background-color: rgba(40, 40, 190, 255); | |
border: 4px solid rgb(20, 20, 120); | |
transition: background-color 1s, border 1s; | |
width: 100%; | |
display: flex; | |
flex-wrap: wrap; | |
align-items: flex-start; | |
justify-content: center; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
} | |
ul { | |
padding: 0; | |
margin: 0; | |
} | |
body { | |
background-color: #eee; | |
margin: 0px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -rf optimized/** | |
mkdir -p optimized/400w | |
convert unoptimized/*.jpg -sampling-factor 4:2:0 -strip -quality 80 -interlace JPEG -colorspace sRGB -set filename:base "%[base]" -resize 700x -sigmoidal-contrast 5,50% optimized/"%[filename:base].jpg" | |
convert unoptimized/*.jpg -sampling-factor 4:2:0 -strip -quality 80 -interlace JPEG -colorspace sRGB -set filename:base "%[base]" -resize 400x -sigmoidal-contrast 5,50% optimized/400w/"%[filename:base].jpg" | |
find ./optimized -regex '.*\.\(jpg\|png\)$' -exec bash -c 'convert "$@" -define webp:lossless=false "${@%.*}".webp' _ {} \; |