ShareShortcuts

Business Days Until Date

rasmus-lo
Fazer fork de “Business Days Until Date”

Criou algo novo a partir deste atalho? Compartilhe como uma derivação: ela se torna um atalho seu, que você gerencia, e as duas páginas têm links entre si para que rasmus-lo receba o crédito.

  1. 1Obtenha o atalho e altere-o no app Atalhos. Dê a ele um nome próprio.
  2. 2Compartilhe pelo app Atalhos e copie o link do iCloud.
  3. 3Volte aqui, cole o link e descreva o que mudou, por exemplo: “Adicionei uma etapa que usa a Apple Intelligence para personalizar o texto.”
Downloads
73K
Salvo
0
Ações
24
Categoria
API
Versão
1.0
Idioma
EN

WolframAlpha - # of business days until a future date

Return the number of business days from now until a future date


The shortcut calculates the number of working days until a future date using the WolframAlpha API.

You'll first need to sign up for your own API key before installing the shortcut:

https://products.wolframalpha.com/api/

Novidades

Versão 1.0

First release

Histórico de versões
1.0 4 de nov de 2018

First release

O que ele faz

24 ações
  1. Text
  2. Comment
    You will need to sign up for your personal API key at https://products.wolframalpha.com/api/ Enter your API key below:
  3. Text
  4. Set Variable
    api_key
  5. Text
  6. Set Variable
    jsonpath_query
  7. Ask for Input
    What is the future date?
  8. Format Date
  9. Set Variable
    date
  10. Text
  11. URL Encode
  12. Text
  13. Get Contents of URL
  14. Get Text from Input
  15. Set Variable
    json_result
  16. Text
  17. Set Variable
    jsonpath_script
  18. Text
  19. Base64 Encode
  20. URL
    data:text/html;base64,…
  21. Get Contents of Web Page
  22. Get Text from Input
  23. Set Variable
    result
  24. Show Result

Ver como código
Beta

Todas as ações deste atalho escritas em Cherri, uma linguagem de programação para o app Atalhos. Ótimo para aprender como ele funciona.

#include 'actions/web'
#include 'actions/calendar'
#define color red
#define glyph calendar

/*
You will need to sign up for your personal API key at https://products.wolframalpha.com/api/

Enter your API key below:
*/
@api_key = "nil"
@jsonpath_query = "$..pods[?(@.scanner == 'Identity')].subpods[?(@.primary == true)].plaintext"
prompt("What is the future date?", "Date")
formatTimestamp("", "Long", "None")
@date = nil
urlEncode("")
downloadURL("")
getText(nil)
@json_result = nil
@jsonpath_script = "/* JSONPath 0.8.0 - XPath for JSON\n *\n * Copyright (c) 2007 Stefan Goessner (goessner.net)\n * Licensed under the MIT (MIT-LICENSE.txt) licence.\n */\nfunction jsonPath(obj, expr, arg) {\n   var P = {\n      resultType: arg && arg.resultType || \\"VALUE\\",\n      result: [],\n      normalize: function(expr) {\n         var subx = [];\n         return expr.replace(/[\['](\??\(.*?\))[\]']/g, function($0,$1){return \\"[#\\"+(subx.push($1)-1)+\\"]\\";})\n                    .replace(/'?\.'?|\['?/g, \\";\\")\n                    .replace(/;;;|;;/g, \\";..;\\")\n                    .replace(/;$|'?\]|'$/g, \\"\\")\n                    .replace(/#([0-9]+)/g, function($0,$1){return subx[$1];});\n      },\n      asPath: function(path) {\n         var x = path.split(\\";\\"), p = \\"$\\";\n         for (var i=1,n=x.length; i<n; i++)\n            p += /^[0-9*]+$/.test(x[i]) ? (\\"[\\"+x[i]+\\"]\\") : (\\"['\\"+x[i]+\\"']\\");\n         return p;\n      },\n      store: function(p, v) {\n         if (p) P.result[P.result.length] = P.resultType == \\"PATH\\" ? P.asPath(p) : v;\n         return !!p;\n      },\n      trace: function(expr, val, path) {\n         if (expr) {\n            var x = expr.split(\\";\\"), loc = x.shift();\n            x = x.join(\\";\\");\n            if (val && val.hasOwnProperty(loc))\n               P.trace(x, val[loc], path + \\";\\" + loc);\n            else if (loc === \\"*\\")\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { P.trace(m+\\";\\"+x,v,p); });\n            else if (loc === \\"..\\") {\n               P.trace(x, val, path);\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { typeof v[m] === \\"object\\" && P.trace(\\"..;\\"+x,v[m],p+\\";\\"+m); });\n            }\n            else if (/,/.test(loc)) { // [name1,name2,...]\n               for (var s=loc.split(/'?,'?/),i=0,n=s.length; i<n; i++)\n                  P.trace(s[i]+\\";\\"+x, val, path);\n            }\n            else if (/^\(.*?\)$/.test(loc)) // [(expr)]\n               P.trace(P.eval(loc, val, path.substr(path.lastIndexOf(\\";\\")+1))+\\";\\"+x, val, path);\n            else if (/^\?\(.*?\)$/.test(loc)) // [?(expr)]\n               P.walk(loc, x, val, path, function(m,l,x,v,p) { if (P.eval(l.replace(/^\?\((.*?)\)$/,\\"$1\\"),v[m],m)) P.trace(m+\\";\\"+x,v,p); });\n            else if (/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(loc)) // [start:end:step]  phyton slice syntax\n               P.slice(loc, x, val, path);\n         }\n         else\n            P.store(path, val);\n      },\n      walk: function(loc, expr, val, path, f) {\n         if (val instanceof Array) {\n            for (var i=0,n=val.length; i<n; i++)\n               if (i in val)\n                  f(i,loc,expr,val,path);\n         }\n         else if (typeof val === \\"object\\") {\n            for (var m in val)\n               if (val.hasOwnProperty(m))\n                  f(m,loc,expr,val,path);\n         }\n      },\n      slice: function(loc, expr, val, path) {\n         if (val instanceof Array) {\n            var len=val.length, start=0, end=len, step=1;\n            loc.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g, function($0,$1,$2,$3){start=parseInt($1||start);end=parseInt($2||end);step=parseInt($3||step);});\n            start = (start < 0) ? Math.max(0,start+len) : Math.min(len,start);\n            end   = (end < 0)   ? Math.max(0,end+len)   : Math.min(len,end);\n            for (var i=start; i<end; i+=step)\n               P.trace(i+\\";\\"+expr, val, path);\n         }\n      },\n      eval: function(x, _v, _vname) {\n         try { return $ && _v && eval(x.replace(/@/g, \\"_v\\")); }\n         catch(e) { throw new SyntaxError(\\"jsonPath: \\" + e.message + \\": \\" + x.replace(/@/g, \\"_v\\").replace(/\^/g, \\"_a\\")); }\n      }\n   };\n\n   var $ = obj;\n   if (expr && obj && (P.resultType == \\"VALUE\\" || P.resultType == \\"PATH\\")) {\n      P.trace(P.normalize(expr).replace(/^\$;/,\\"\\"), obj, \\"$\\");\n      return P.result.length ? P.result : false;\n   }\n} "
base64Encode(nil)
url("data:text/html;base64,{}")
getWebpageContents("")
getText(nil)
@result = nil
show("There are {@result} until {@date}")
Abrir no Cherri Playground Descompilado com cherri 2.3.0 (GPL-2.0). Pode precisar de pequenos ajustes antes de compilar.

Avaliações e comentários

Escrever uma avaliação
–
de 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Ainda não há avaliações. Seja o primeiro a compartilhar o que você pensa!

Publicidade

Mais de rasmus-lo

Ver tudo

Você também pode gostar

Ver tudo
Publicidade