Skip to content

Instantly share code, notes, and snippets.

@watershed
watershed / vimeo-embed-url.html
Last active September 24, 2021 14:10
Vimeo embedding
View vimeo-embed-url.html
<!-- Historically, Vimeo URLs of the following form would work as a straightforward `src` attribute value on an iframe -->
<iframe src="https://player.vimeo.com/video/123456789" width="X" height="Y" allowfullscreen></iframe>
<!-- At some point in September 2021 Vimeo changed this, so that URLs require an `h` parameter to work -->
<iframe src="https://player.vimeo.com/video/123456789?h=8yt65b2a98" width="X" height="Y" allowfullscreen></iframe>
<!--
In the above examples:
View bodyContentMacros.twig
{#####
For a `body` field with type:fieldHandles structure:
collStart: collId*, attr
subheading: text*, customId, hWrap, incToC
text: text*
quote: text*, cite, citeUrl
images images* (needs work)
video: videoUrl*,ratio
collEnd collId*
@watershed
watershed / dateTimeMacro.twig
Last active July 2, 2021 10:31
CraftCMS datetime macro
View dateTimeMacro.twig
{#
value : date and/or time value validated as not null (mandatory),
format : php date format string (mandatory),
options: {
prefix: string to append to processed format,
suffix: string to append to processed format,
tag : html tagname string,
html : markup, typically to be wrapped in a <time> element,
attr : hash of name:value attribute pairs
}
@watershed
watershed / rename-files-in-folder-to-all-lowercase.sh
Created June 19, 2018 16:42
Rename files in folder to all lowercase
View rename-files-in-folder-to-all-lowercase.sh
for f in *; do mv "$f" "$f.tmp"; mv "$f.tmp" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done
@watershed
watershed / update-multiple-rows-same-column.sql
Created June 14, 2018 08:54
MySQL: update multiple rows for the same column/field
View update-multiple-rows-same-column.sql
UPDATE table_name
SET field_to_update = CASE id
WHEN n THEN 'Text value'
END
WHERE id IN (n)
@watershed
watershed / select-files-from-list.scpt
Created June 14, 2018 08:52
Select files from list AppleScript
View select-files-from-list.scpt
set myValues to {"filename.ext", "filename.ext"}
tell application "Finder" to set fileList to files of target of front Finder window as alias list
set matchedFiles to {}
repeat with aFile in my fileList
repeat with aValue in myValues
tell application "System Events" to if aFile's name contains (contents of aValue) then set end of matchedFiles to (aFile as text)
end repeat
end repeat
@watershed
watershed / craft-instruction-links.js
Last active January 2, 2016 14:44
CraftCMS: force links in field instructions to open in a new window
View craft-instruction-links.js
@watershed
watershed / management-bios.html
Created October 6, 2011 12:26
Management styling in IE7
View management-bios.html
<!-- The nested structure is at present like this -->
<div class="panel vcard" id="[hcard-forename-surname]">
<div class="header">
<h2 class="fn h3">[Forename] [Surname]</h2>
<div class="title">[Job title]</div>
</div>
<div class="figure left1of3">
<img alt="[Forename] [Surname]" src="[image_url]" class="photo">
</div>
<div class="bio">
View A menu experiment with slanting list items for #pfmeet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>A menu experiment with slanting list items</title>
<style type="text/css" title="text/css" media="screen">
<!--
* {margin: 0; padding: 0;}
@watershed
watershed / compare_cell_example.html
Created June 4, 2011 07:45
Compare table cell example
View compare_cell_example.html
<!-- Example cell with JavaScript on -->
<td class="linked">
<a href="/Datasheets/redPOWER_R4/100-400W_RS_series.aspx?" title="View RS datasheet">
<a title="View RS datasheet" href="/Datasheets/redPOWER_R4/100-400W_RS_series.aspx?">
<em class="good">Good</em>
</a>
</a>
</td>
<!-- Same cell with JavaScript off (HTML sent to browser) -->