Skip to content

Instantly share code, notes, and snippets.

Add git to existing Xcode 4 project

It's easier than you might think, so let's take a closer look at it. We will use the Mac Terminal app to accomplish our goal.

cd #path to projectfolder         // Change directory to projectfolder
git init                          // Init the git repository in  
git add .                         // Add this folder to the created git repo
git commit -m "Initial commit" // Commit the files with arbitary message
'''
This python script listens for distributed notifications from iTunes of new songs playing,
works alot better then constantly polling.
'''
import Foundation
from AppKit import *
from PyObjCTools import AppHelper
class GetSongs(NSObject):
def getMySongs_(self, song):
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/contact');
var Schema = mongoose.Schema;
var ContactSchema= new Schema({
name: { type: String, required: true },
phone: { type: Number },
});
var ContactModel = mongoose.model('Contact', ContactSchema);
showfiles=`defaults read com.apple.Finder AppleShowAllFiles`
if [ "$showfiles" = "TRUE" ]; then
say Hidden items disabled
defaults write com.apple.finder AppleShowAllFiles FALSE
else
say Hidden items enabled
defaults write com.apple.finder AppleShowAllFiles TRUE
fi
#!/bin/sh## Creates a disk image (dmg) on Mac OS X from the command line.# usage:# mkdmg <volname> <vers> <srcdir>## Where <volname> is the name to use for the mounted image, <vers> is the version# number of the volume and <srcdir> is where the contents to put on the dmg are.## The result will be a file called <volname>-<vers>.dmgif [ $# != 3 ]; then echo "usage: mkdmg.sh volname vers srcdir" exit 0fiVOL="$1"VER="$2"FILES="$3"DMG="tmp-$VOL.dmg"# create temporary disk image and format, ejecting when doneSIZE=`du -sk ${FILES} | sed -n '/^[0-9]*/s/([0-9]*).*/1/p'`SIZE=$((${SIZE}/1000+1))hdiutil create "$DMG" -megabytes ${SIZE} -ov -type UDIFDISK=`hdid "$DMG" | sed -ne ' /Apple_partition_scheme/ s|^/dev/([^ ]*).*$|1|p'`newfs_hfs -v "$VOL" /dev/r${DISK}s2hdiutil eject $DISK# mount and copy files onto volumehdid "$DMG"cp -R "${FILES}"/* "/Volumes/$VOL"hdiutil eject $DISK#osascript -e "tell application "Finder" to eject disk "$VOL"" && # convert to compressed image, delete temp imagerm -f "${VOL}-${VER}.dmg"hdiut
NSURL *originalUrl=[NSURL URLWithString:@"http://YourURL.com"];
NSData *data=nil;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:originalUrl cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];
NSURLResponse *response;
NSError *error;
data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSURL *LastURL=[response URL];
[request release];
[error release];
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes');
var app = module.exports = express.createServer();
// Configuration
var express = require('express');
var app = express();
// New call to compress content
app.use(express.compress());
app.use(express.static(__dirname + '/public'));
app.listen(process.env.PORT || 3000);