Archives for March 2011...

(2 results found)

Node.js - better than sliced bread!

Fri Mar 25 03:23:58 2011

For those who haven't heard about Joyent and Node.js, you should definitely take a look. This has got to be one of the best things to happen to the Internet in while!

Also, just wanted to post a quick link to the blog post that got me up and running: Building a socket server with Node.js and Flash CS4

I did the tutorial linked above without Flash and here's the AS3 code I threw together just to test it out. It literally took 5 mins to write so no complaints if you don't like my rushed code, thank you.

Want to say a big thanks to my friend Dan for introducing this stuff to me. It made my day, I can tell ya!

Using Dropbox as a remote for git

Thu Mar 24 04:36:51 2011

dropbox-n-gitSetting up a git remote on Dropbox is great for backing up and sharing projects with other people. Here's how to get started.

Getting a local repository started

First off open a Terminal window and create a project folder. I'm going to make one in my ~/Sites folder of my mac using the command mkdir (make directory) and cd (change directory) inside.

cd ~/Sites/
mkdir project
cd project

Next create a git repository inside the folder project

git init

When you want to add files that are saved in the projects folder to the repository, use the add and commit commands. For example, say you have the file index.html in your project folder, use git add * where * means everything/all, but can be a specific file name such as index.html. Using the command git status will show you if any changes have been made or/and if there are any untracked files that exist in the directory. Right now, no files have been commited to the repository, so the 'index.html' should be displayed. Run the following to commit to the repository:

git commit -a -m "Initial commit"

The -m followed by a message in between " " will be the message that is display in the log/history of changes. After commiting changes, run git log to view the git history.

Creating and "Pushing" to a Remote (i.e. Dropbox)

Now, in the same way we created a directory for the project, we have to also make a directory for the remote branch. I will make one called "Repository" in the root of Dropbox and then make another folder inside that called project.git, for sake of ease.

cd ~/Dropbox
mkdir Repository
cd Repository
mkdir project.git
cd project.git

Now that we're inside project.git, let's create a bare repository

git init --bare

Now, all that's left is to add our Dropbox remote to the repository of our project and push to it. (We'll have to cd back into the local project folder for that)

cd ~/Sites/project
git remote add origin ~/Dropbox/Repository/project.git
git push origin master

Now, if everything went OK, you should be able to run git log from inside ~/Dropbox/Repository/project.git and view the same log as ~/Sites/project.

Pulling from the Dropbox Remote

Let's say that you are now on a different computer with access to Dropbox. It's really easy to clone and pull files from the remote and code anywhere!

cd ~/Sites
git clone -o Dropbox file://$HOME/Dropbox/Repository/project.git

You should now see the new project folder on inside your ~/Sites folder as it was when you left if on your other computer!

Just rememeber to push any changes made here to the Dropbox remote and then git pull origin master will pick things up again on any other computers that have cloned the repository. Cool eh? Saves room in my pockets where a USB drive used to be :)

Most recent posts

  1. Flashcards Maker - the app the helps you learn in a flash
  2. Convert Font Suitcase to TTF in 3 Easy Steps
  3. Rain or Shine - Weather Forecast Available Now!
  4. Getting around Apple's silly rules for iOS 10
  5. Localising App Names for iOS and Android

Search site:

Apps by Ubacoda.com

Click the app icons to see more info


Archives

Categories