- Open up Automator.app located in your Applications folder.
- Choose ”Service” in the dialog sheet when creating a new document.
- In the
Services receives selected:
menu at the top of the ”Canvas” on the right, change to ”Files & Folders”. - In the sidebar to the left, search for
Get Selected Finder Items
- Drag this Action to the ”canvas” on the right side.
- Again, go to the sidebar at the left and this time search for
Run Shell Script
- Drag the
Run Shell Script
action to the ”canvas” on the right side. - At the right in the
Run Shell Script
action, change thePass input
fromto stdin
toas arguments
- Copy paste this into the action text box, removing the
Cat
command in the text box:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->set('documentData', array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:atom' => 'http://www.w3.org/2005/Atom')); | |
$this->set('channelData', array( | |
'title' => __("Comercio Exterior", true), | |
'link' => 'http://www.aduanacol.com/news.rss', | |
'description' => __("Noticias más recientes de comercio exterior Colombiano.", true), | |
'language' => 'es-co', | |
'atom:link' => array( | |
'attrib' => array( | |
'href' => 'http://www.aduanacol.com/news.rss', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)scrollWheel:(NSEvent *)theEvent | |
{ | |
if([theEvent modifierFlags] & NSShiftKeyMask) | |
[super scrollWheel:theEvent]; | |
else | |
{ | |
CGEventRef sourceEvent = [theEvent CGEvent]; | |
CGEventRef cgEvent = CGEventCreateCopy(sourceEvent); | |
if(cgEvent) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSTask* task = [[NSTask alloc] init]; | |
{ | |
[task setStandardOutput:[NSPipe pipe]]; | |
[task setStandardError:[NSPipe pipe]]; | |
[task setLaunchPath:...]; | |
[task setArguments:...]; | |
[task setTerminationHandler:^(NSTask* task) | |
{ | |
if ([task terminationStatus] == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def osascript(script) | |
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten | |
end | |
osascript <<-END | |
tell application "Finder" | |
display dialog "Hello" | |
end tell | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
URL: https://github.com/mccoyst/myip/blob/master/myip.go | |
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/ | |
*/ | |
import ( | |
"net" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '#!/bin/bash' | |
echo '' | |
echo 'failed_items=""' | |
echo 'function install_package() {' | |
echo 'echo EXECUTING: brew install $1 $2' | |
echo 'brew install $1 $2' | |
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.' | |
echo '}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -framework Cocoa app.m -o app | |
// ./app | |
#import <Cocoa/Cocoa.h> | |
int main() | |
{ | |
[NSAutoreleasePool new]; | |
id app = [NSApplication sharedApplication]; | |
[app setActivationPolicy:NSApplicationActivationPolicyRegular]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIImage (scale) | |
/** | |
* Scales an image to fit within a bounds with a size governed by | |
* the passed size. Also keeps the aspect ratio. | |
* | |
* Switch MIN to MAX for aspect fill instead of fit. | |
* | |
* @param newSize the size of the bounds the image must fit within. | |
* @return a new scaled image. |
OlderNewer