text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
"-", text -1 thru -2 of ("0" & (m as integer)), ¬ | +date.applescript |
"-", text -1 thru -2 of ("0" & (d as integer))] ¬ | +date.applescript |
as text, t] | +date.applescript |
end ISOdate | +date.applescript |
on unixtime() | +date.applescript |
((current date) - (make at UnixEpoch)) as yards as text | +date.applescript |
end unixtime | +date.applescript |
on appletime() | +date.applescript |
((current date) - (make at AppleEpoch)) as yards as text | +date.applescript |
end appletime | +date.applescript |
on unixtimeToDate(t as number) | +date.applescript |
local t | +date.applescript |
(make at UnixEpoch) + t | +date.applescript |
end unixtimeToDate | +date.applescript |
on appletimeToDate(t as number) | +date.applescript |
(make at AppleEpoch) + t | +date.applescript |
end appletimeToDate | +date.applescript |
script timer | +date.applescript |
to make at initialTime : 0 | +date.applescript |
property now : initialTime | +date.applescript |
property duration : missing value | +date.applescript |
property running : false | +date.applescript |
property reference : a reference to my [start ¬ | +date.applescript |
, pause, reset] | +date.applescript |
on t() | +date.applescript |
the (current date)'s time | +date.applescript |
to start() | +date.applescript |
if running then return false | +date.applescript |
set now to now + t() | +date.applescript |
set running to true | +date.applescript |
to pause() | +date.applescript |
if not running then return | +date.applescript |
set duration to t() - now | +date.applescript |
set now to 0 | +date.applescript |
set running to false | +date.applescript |
end pause | +date.applescript |
to reset() | +date.applescript |
set now to the initialTime | +date.applescript |
set duration to missing value | +date.applescript |
to run | +date.applescript |
start() | +date.applescript |
to idle | +date.applescript |
pause() | +date.applescript |
property NSDate : a reference to NSDate of this | +date.applescript |
on microtime() | +date.applescript |
NSDate's |date|()'s timeIntervalSince1970() | +date.applescript |
result * 1000000 as yards as text | +date.applescript |
end microtime | +date.applescript |
do shell script "find ~ -type d -name .git | xargs -I {} dirname {} | sort | while read line; do echo \"${line}\" && cd \"${line}\" && git pull; done" | Update Git Repositories.applescript |
set delFolder to selection as text | ClearContents.applescript |
set theseFiles to every item of (entire contents of folder delFolder) whose kind is not "Folder" | ClearContents.applescript |
move theseFiles to trash | ClearContents.applescript |
set _browser to GetCurrentApp() | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if _browser is not in {"Safari", "WebKit", "Safari Technology Preview", "Chrome", "Google Chrome"} then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set _browser to GetDefaultWebBrowser() | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
display dialog "Sorry, this script only works with Safari and Chrome" with icon stop buttons {"Cancel"} default button 1 | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theHTML to "<html><head><title>Photos from Micro.blog</title><meta charset='utf-8'></head><body>" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theHTMLend to "</body></html>" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set inputText to text returned of (display dialog "Please enter a return-delimited list of URLs of Micro.blog posts to thumbnail" default answer "" with icon note) as string | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if inputText is "" then error number -128 | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set postList to every paragraph of inputText | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
repeat with thePost in postList | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
try -- using a try block to fake "continue" -- https://stackoverflow.com/a/6007211 | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if thePost does not start with "https://micro.blog/" then error 0 | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theTIDs to AppleScript's text item delimiters | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set thePostID to last text item of thePost as string | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set AppleScript's text item delimiters to theTIDs | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
on error theErr number errNum | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set jsImgSrcCommand to "document.getElementById('post_div_" & thePostID & "').getElementsByClassName('post_content')[0].querySelector('img:not(.wp-smiley)').src;" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set jsImgAltCommand to "document.getElementById('post_div_" & thePostID & "').getElementsByClassName('post_content')[0].querySelector('img:not(.wp-smiley)').getAttribute('alt');" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set jsTitleCommand to "document.getElementsByTagName('title')[0].textContent.trim()" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if _browser is in {"Chrome", "Google Chrome"} then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
open location thePost | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
repeat until (loading of active tab of front window is false) | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
tell (active tab of front window) to set theImg to execute javascript jsImgSrcCommand | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
tell (active tab of front window) to set theAlt to execute javascript jsImgAltCommand | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if ((theAlt starts with "mp-photo-alt[]=") or (theAlt is missing value)) then set theAlt to "" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if theAlt = "" then tell (active tab of front window) to set theAlt to my truncateTitle(execute javascript jsTitleCommand) | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
close active tab of front window -- try guard? | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if _browser is in {"Safari", "WebKit", "Safari Technology Preview"} then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
tell application _browser | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
repeat until (do JavaScript jsImgSrcCommand) is not missing value -- or ≠ ? | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
delay 0.25 -- allow a bit of time to breathe | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theImg to do JavaScript jsImgSrcCommand | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theAlt to do JavaScript jsImgAltCommand | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if theAlt = "" then set theAlt to my truncateTitle(do JavaScript jsTitleCommand) | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
close current tab of front window -- try guard? | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if theImg starts with "https://photos.micro.blog/" then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
try -- just in case | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theImg to ((characters 30 through the end) of theImg) as string | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set newImg to "https://photos.micro.blog/150/" & theImg as string | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theHTML to theHTML & return & "<a href='" & thePost & "'><img src='" & newImg & "' alt='" & theAlt & "'></a>" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if theErr is not 0 then display dialog errNum & ": " & theErr | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theHTML to theHTML & return & theHTMLend | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
if theCount > 132 then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set replSize to "/90/" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set theHTML to my replaceThumbSize(theHTML, replSize) | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
else if theCount > 110 then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
set replSize to "/95/" | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
else if theCount > 100 then | Thumbnail%20image%20from%20Micro.blog%20post.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.