Skip to main content


Showing posts from December, 2010

git merge --squash

Start out on branch master, then work on an experimental branch

$ git checkout -b experimental
Do a series of commits etc. If you decide that the experimental features should now be part of master, do the following:

$ git checkout master $ git merge --squash experimental $ git commit -a
The commit message automatically has a list of all commits in experimental.

Uploading a file with JQuery

You can easily submit data in an html form via jQuery's $.post. But you need to do a little more to upload a file. I suggest the jQuery Form Plugin.

Here is the HTML form:
<html> <head> <title>Title</title> </head> <body> <form action="/test.cgi" enctype="multipart/form-data" method="post"> <input name="myFile" type="file" /> <div id="results"> </div> </form> </body> </html>
This is the Javascript file myFrom.js:
$(document).ready(function() { $('form').ajaxForm( { beforeSubmit: function() { $('#results').html('Submitting...'); }, success: function(data) { var $out = $('#results'); $out.html('Your results:'); $out.append('<div><pre>'+ data +'</pre></div>'); } …

Happy Holidays!