text
stringlengths
0
15.7k
source
stringlengths
6
112
(my sum:L) / (length of L)
+arrays.applescript
end mean:
+arrays.applescript
on swap(L, i, j)
+arrays.applescript
local L, i, j
+arrays.applescript
set [item i of L, item j of L] to [item j, item i] of L
+arrays.applescript
to sort:(L as list)
+arrays.applescript
if L = {} then return {}
+arrays.applescript
if L's length = 1 then return L
+arrays.applescript
set [x, xs] to [¬
+arrays.applescript
a reference to its item 1, ¬
+arrays.applescript
a reference to rest of it]
+arrays.applescript
set [i] to my (offset of (my min:it) in it)
+arrays.applescript
if i ≠ 1 then my swap(it, 1, i)
+arrays.applescript
set its contents to {x's contents} & (my sort:(xs))
+arrays.applescript
end sort:
+arrays.applescript
to rotate:L
+arrays.applescript
if length of L < 2 then return L
+arrays.applescript
property x : item 1 of my list
+arrays.applescript
to unshift(x, i, L)
+arrays.applescript
local x, i, L
+arrays.applescript
if i = L's length then return missing value
+arrays.applescript
item (i + 1) of L
+arrays.applescript
end unshift
+arrays.applescript
mapItems from L given handler:result's unshift
+arrays.applescript
set last item of L to x
+arrays.applescript
end rotate:
+arrays.applescript
on cycle:L
+arrays.applescript
(rest of L) & item 1 of L
+arrays.applescript
end cycle:
+arrays.applescript
to flatten:L
+arrays.applescript
foldItems from L at {} given handler:union
+arrays.applescript
end flatten:
+arrays.applescript
on head:L
+arrays.applescript
tell (a reference to L)
+arrays.applescript
set its contents to item 1
+arrays.applescript
return its contents
+arrays.applescript
end head:
+arrays.applescript
on tail:L
+arrays.applescript
set its contents to the rest of L
+arrays.applescript
end tail:
+arrays.applescript
to shift(L)
+arrays.applescript
tail_(L)
+arrays.applescript
on body:L
+arrays.applescript
if L's length < 2 then return null
+arrays.applescript
items 1 thru -2 of L
+arrays.applescript
end body:
+arrays.applescript
on anus:L
+arrays.applescript
if L's length < 1 then return null
+arrays.applescript
item -1 of L
+arrays.applescript
end anus:
+arrays.applescript
on torso:L
+arrays.applescript
tail_(body_(L))
+arrays.applescript
end torso:
+arrays.applescript
set destinationData to {}
Web Scraping - Google Travel Flights.applescript
set numberOfMystery to do JavaScript "document.getElementsByClassName('Xq1DAb').length"
Web Scraping - Google Travel Flights.applescript
repeat with i from 3 to numberOfMystery + 1
Web Scraping - Google Travel Flights.applescript
set end of destinationData to {¬ do JavaScript "document.getElementsByClassName('tsAU4e')[" & i & "].firstChild.firstChild.textContent", ¬ do JavaScript "document.getElementsByClassName('tsAU4e ')[" & i & "].childNodes[1].firstChild.firstChild.firstChild.textContent", ¬ do JavaScript "document.getElementsByClassName('Xq1DAb')[" & i - 2 & "].textContent"}
Web Scraping - Google Travel Flights.applescript
set caseId to "dec-user-zoom"
dec-user-zoom.applescript
Manual: Is in meeting (yes, no)
dec-user-zoom.applescript
Manual: Is screen sharing (yes, no)
dec-user-zoom.applescript
set sut to std's import("user")'s new()
dec-user-zoom.applescript
if name of sut is not "UserZoomInstance" then set sut to decorate(sut)
dec-user-zoom.applescript
logger's infof("In Meeting: {}", sut's isInMeeting())
dec-user-zoom.applescript
logger's infof("Is Screen Sharing: {}", sut's isScreenSharing())
dec-user-zoom.applescript
script UserZoomInstance
dec-user-zoom.applescript
on isInMeeting()
dec-user-zoom.applescript
if _isZoomInstalled() is false then
dec-user-zoom.applescript
continue isInMeeting()
dec-user-zoom.applescript
if running of application "zoom.us" is false then return false
dec-user-zoom.applescript
tell application "System Events" to tell process "zoom.us"
dec-user-zoom.applescript
(exists window "Zoom Meeting") or (exists window "zoom share statusbar window") or (exists window "Zoom Webinar")
dec-user-zoom.applescript
end isInMeeting
dec-user-zoom.applescript
on isScreenSharing()
dec-user-zoom.applescript
if running of application "zoom.us" is false then return continue isScreenSharing()
dec-user-zoom.applescript
return exists window "zoom share statusbar window"
dec-user-zoom.applescript
end isScreenSharing
dec-user-zoom.applescript
on _isZoomInstalled()
dec-user-zoom.applescript
if std's appExists("zoom.us") is false then return false
dec-user-zoom.applescript
set zoomApp to std's import("zoom")
dec-user-zoom.applescript
end _isZoomInstalled
dec-user-zoom.applescript
set logger to std's import("logger")'s new("dec-user-zoom")
dec-user-zoom.applescript
tell application "iTunes" to stop
itunes_stop.scpt
repeat with ii in input
search_in_spotify.workflow.scpt
set selected to ii
search_in_spotify.workflow.scpt
set cmd to "python -c 'import urllib, sys; print urllib.quote(sys.argv[1])'" & " " & quoted form of selected
search_in_spotify.workflow.scpt
set encoded to do shell script cmd
search_in_spotify.workflow.scpt
set prefix to "spotify:search:"
search_in_spotify.workflow.scpt
set search_url to prefix & encoded
search_in_spotify.workflow.scpt
open location search_url
search_in_spotify.workflow.scpt
display alert "Hello, world!" buttons {"Rudely decline", "Happily accept"}
AppleScript_AdvancedHelloWorld.applescript
set theAnswer to button returned of the result
AppleScript_AdvancedHelloWorld.applescript
if theAnswer is "Happily accept" then
AppleScript_AdvancedHelloWorld.applescript
beep 5
AppleScript_AdvancedHelloWorld.applescript
say "Piffle!"
AppleScript_AdvancedHelloWorld.applescript
log randomDateAndTimeInRange((current date) - 10 * 365 * 24 * 60 * 60, (current date), 9 * 60 * 60, 17 * 60 * 60)
randomDateAndTime.applescript
on randomDateAndTimeInRange(minDate, maxDate, minSeconds, maxSeconds)
randomDateAndTime.applescript
if minDate is false then set minDate to current date
randomDateAndTime.applescript
if maxDate is false then set maxDate to current date
randomDateAndTime.applescript
if minDate > maxDate then
randomDateAndTime.applescript
error "randomDate(): Minimum date needs to be the same as or later than maximum date"
randomDateAndTime.applescript