Skip to content

Instantly share code, notes, and snippets.

@joech4n
Last active January 30, 2016 18:33
Show Gist options
  • Save joech4n/11961dc2f76162c82286 to your computer and use it in GitHub Desktop.
Save joech4n/11961dc2f76162c82286 to your computer and use it in GitHub Desktop.
diff -r /Users/username/Documents/Application Files/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EXAMPLE2-2F60-47D2-8D2F-EXAMPLEB4D4D/clipboard.php /Users/username/Documents/Application Files/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EXAMPLEB-DC3B-4DE5-8C07-EXAMPLE5D00C/clipboard.php
11,12c11,13
< echo $xml->pod[1]->subpod->plaintext;
< ?>
\ No newline at end of file
---
> #echo $xml->pod[1]->subpod->plaintext; # original
> echo $q # pass through selection that's copied
> ?>
diff -r /Users/username/Documents/Application Files/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EXAMPLE2-2F60-47D2-8D2F-EXAMPLEB4D4D/wolfram.php /Users/username/Documents/Application Files/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.EXAMPLEB-DC3B-4DE5-8C07-EXAMPLE5D00C/wolfram.php
32,39c32,60
< $w->result(
< "wolfram $q",
< $q,
< $xml->pod[1]->subpod->plaintext,
< $xml->pod[0]->subpod->plaintext,
< 'icon.png',
< 'yes'
< );
---
>
> $isFirst = true;
> foreach ($xml->pod as $pod) {
>
> /* Skipping first pod, "Input interpretation" */
> if ($isFirst) {
> $isFirst = false;
> continue;
> }
>
> /* Print every answer, helpful for throughput queries like "21341 bytes per 10 seconds" */
> foreach ($pod->subpod as $subpod) {
>
> /* Remove new lines from results */
> $result_string = trim(preg_replace('/\s\s+/', ' ', $subpod->plaintext));
>
> $w->result(
> "wolfram $q",
> "$q = $result_string",
> $result_string,
> $xml->pod[0]->subpod->plaintext,
> 'icon.png',
> 'yes'
> );
>
> }
> }
>
>
56c77
< ?>
\ No newline at end of file
---
> ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment