Jump to content

elnadav12

Member
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by elnadav12

  1. 14 hours ago, Andrew said:

    Just to let you know, I'm working on new theming options which will allow for rounded corners and also to use the native macOS Visual Effect view (the blur effect you get in Spotlight and various windows around macOS). A side effect of the using this native view type is getting proper window surround, and no fuzzy corners.

     

    Here is an example:

     

    Alfred 4.3 theme example

     

     

    That's great!

  2. This theme is absolutely awesome.

    Most people won't even notice that's not spotlight!

    The only thing I changed was the horizontal window padding -> zero.

    The rounded corners glitch is a little annoying but that's a small compromise for this incredible design!

    Thanks Julian!

    101675242_AlfredDarkSky.thumb.jpg.0a3712970c90fe91746b4e4c8de23660.jpg

  3. 1 minute ago, vitor said:

    Make a Script Filter with ruby as the language and this code:

     

    
    require 'cgi'
    require 'json'
    require 'net/http'
    
    query = ARGV[0]
    escaped_query = CGI.escape(query)
    
    simple_api = 'https://api.wolframalpha.com/v1/simple?i=' + escaped_query + '&appid=' + ENV['api_key']
    short_answers_api = 'https://api.wolframalpha.com/v1/result?i=' + escaped_query + '&appid=' + ENV['api_key']
    
    result = Net::HTTP.get_response(URI.parse(short_answers_api)).body
    
    puts({ items: [ title: result, subtitle: query, arg: result, quicklookurl: simple_api ] }.to_json)

     

    Results are inline and you can press ⇧ or ⌘Y to get a quicklook preview of the page.

     

    It assumed you’ve got an API key and placed it in a api_key Workflow Environment Variable.

    Thanks a lot!

    The API is limited to 2000 calls a month, will this script call the api each time I write a new letter?

     

  4. 1 hour ago, deanishe said:

     

    Either. Or Ruby. Pretty much any general-purpose language has the features you need (URL encoding, HTTP client & JSON).

    Thanks for the help!

    Is this code any good?

    Quote

    require("workflows.php");
     
    $wf = new Workflows();
    // $word = "{query}";
    $word = str_replace(' ', '+', "{query}");
    $url = "http://api.wolframalpha.com/v1/result?appid=DEMO&i=".$word;
    // replace file_get_contents with $wf->request
    // it's not better, it's cleaner IMHO
    $answer = $wf->request( $url );
    // $raw = file_get_contents( $url );
    $wf->result( time(), $url, $answer, 'WolframAlpha search result', 'icon.png', 'yes', $url);
    echo $wf->toxml();

     

  5. Hello,

    After some looking around I found this workflow that uses WolframAlpha's api to get direct search results.

    https://www.packal.org/workflow/wolframalpha

    This workflow is very cool but takes ages to load.

    WolframAlpha has a cool short answer api that returns answer to a url with the question.

    https://products.wolframalpha.com/short-answers-api/documentation/

    Since it's that simple I imagine that making a workflow that fetches the url, for example "http://api.wolframalpha.com/v1/result?appid=DEMO&i={query}", and returns the result as an Alfred title wouldn't be hard to make, and should run fast...

    What's the right language for the job? PHP? Python? I'm not really sure.

    I have no experience with both so where should I begin?

    Thanks for your time!

×
×
  • Create New...