Skip to content

Instantly share code, notes, and snippets.

@christopheranderton
christopheranderton / macosx-contextmenu-automator-touch.md
Last active February 3, 2024 17:45
Add a simple ”Touch” Service to your context menu (Right-Click Menu) in MacOS X (Tested in Mac OS X 10.10.5, but should work in older and newer versions as well) with Automator.app
  1. Open up Automator.app located in your Applications folder.
  2. Choose ”Service” in the dialog sheet when creating a new document.
  3. In the Services receives selected: menu at the top of the ”Canvas” on the right, change to ”Files & Folders”.
  4. In the sidebar to the left, search for Get Selected Finder Items
  5. Drag this Action to the ”canvas” on the right side.
  6. Again, go to the sidebar at the left and this time search for Run Shell Script
  7. Drag the Run Shell Script action to the ”canvas” on the right side.
  8. At the right in the Run Shell Script action, change the Pass input from to stdin to as arguments
  9. Copy paste this into the action text box, removing the Cat command in the text box:
@Chaser324
Chaser324 / GitHub-Forking.md
Last active April 17, 2024 22:46
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@tomasbasham
tomasbasham / UIImage+Scale.m
Last active February 1, 2024 19:04
Scale a UIImage to any given rect keeping the aspect ratio
@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.
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
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"
#!/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 '}'
@dinge
dinge / gist:6983008
Created October 14, 2013 22:05
calling applescript from ruby
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
@blackymetal
blackymetal / cakephp atom link
Created July 27, 2013 23:10
CakePHP adding atom:link to channel using RSS Helper
@andreashanft
andreashanft / gist:5116781
Created March 8, 2013 14:29
Handling output of a NSTask
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)
{
@bellbind
bellbind / app.m
Created July 19, 2012 20:32
[macosx][objective-c]Make cocoa app without Xcode
// clang -framework Cocoa app.m -o app
// ./app
#import <Cocoa/Cocoa.h>
int main()
{
[NSAutoreleasePool new];
id app = [NSApplication sharedApplication];
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags