Skip navigation

When zipping up a file in MacOS, you can often be found including an unwanted .DS_Store file. Use this option to make sure it doesn’t exist in your .tar.gz file.

tar --exclude='*DS_Store' -zcvf random_number_generator.tar.gz random_number_generator
a random_number_generator
a random_number_generator/interface.json
a random_number_generator/random_number_generator.json
a random_number_generator/random_number_generator.py

You will notice the folder will not contain the .DS_Store file.

This is an essential plugin to install, if you use the command line for your Git operations:

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Then modify your .profile or .bash_profile:

if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi

References:

– http://apple.stackexchange.com/questions/55875/git-auto-complete-for-branches-at-the-command-line/55886#55886

Found these awesome GIT resources for doing presentations or slides…

  • http://lab.hakim.se/reveal-js – Reveal JS
  • http://imakewebthings.com/deck.js/ – Deck.JS
  • https://slides.com/ – A commercial host for Deck.JS
  • http://bartaz.github.io/impress.js – Impress.JS – 3D and seems to be the best
  • http://strut.io/ – A commercial editor for Impress.JS

Git-Logo-White

 

Deleting a file or folder from git uses the rm command.

  • Delete the folder locally and remotely.
git rm dist
git commit -m "Removing distribution files from repo."
  • Delete the folder ONLY from the remote branch:
git rm --cached dist
git commit -m "Removing distribution files from repo."

References:

StackOverflow saves the day again:

  • http://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-git-repo

 

Git-Logo-White

This is a great article on the Git Branching Model.

http://nvie.com/posts/a-successful-git-branching-model/

Basically, all development work should be done on a separate branch off the master, which we would call “develop”. Any features would be branches off develop and merged back to develop once tested and complete.

Atlassian also describes several Git models, with the branching model also explained:

https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow/

Git-Logo-White

 

Deleting a remote branch seems is easy.

  • First, delete the branch locally.
git branch -d feature-to-delete
  • Next, delete the branch remotely by “pushing” the deletion.
git push origin --delete feature-to-delete
  or
git push origin :feature-to-delete

Note that doing a push to delete a remote branch deletes the remote-tracking branch (there are actually 3 branches when a local branch has a remote), so no pruning is necessary.

Pretty easy right!

Things to note: the -d will give you a warning if the branch has not yet been merged. The -D option will do a force deletion and you may lose your un-merged changes.

References:

This StackOverflow article has a lot of good answers:

  • http://stackoverflow.com/questions/2003505/delete-a-git-branch-both-locally-and-remotely

 

logo-mongodb-onwhite

When searching for records that fall within a certain date, using a timestamp, you may want to look at these queries:

// From http://stackoverflow.com/questions/11973304/mongodb-mongoose-querying-at-a-specific-date

db.posts.find( //query today up to tonight
  {"created_on": {"$gte": new Date(2012, 7, 14), "$lt": new Date(2012, 7, 15)}})

Another way to do this:

var start = new Date(2010, 11, 1);
var end = new Date(2010, 11, 30);

db.posts.find({created_on: {$gte: start, $lt: end}});
//taken from http://cookbook.mongodb.org/patterns/date_range/

If searching against the ObjectID timestamp, use this query:

> var objIdMin = ObjectId(Math.floor((new Date('1990/10/10'))/1000).toString(16) + "000
0000000000000")
> var objIdMax = ObjectId(Math.floor((new Date('2011/10/10'))/1000).toString(16) + "000
    0000000000000")
> db.myCollection.find({_id:{$gt: objIdMin, $lt: objIdMax}})

// From http://stackoverflow.com/questions/13593896/mongodb-perform-a-date-range-query-from-the-objectid-in-the-mongo-shell?lq=1

Querying using the Mongo Timestamp object:

db.Collection.find({
  created_at : {
      '$gte': new Timestamp(new Date(2012, 0, 21), 0), 
      '$lte': new Timestamp(new Date(2012, 0, 22), 0)
  }
});

// From GIST https://gist.github.com/guilleferrer/1669783

logo-mongodb-onwhite

When performing find() queries in the Mongo shell, you may have noticed you get a maximum of 20 rows before having to request the next records with the “it” command.

This can be configured!

From http://docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/, enter this line of code in the shell

DBQuery.shellBatchSize = 100;

This will allow you to display up to 100 records at a time when performing queries in the shell. You can configure this at any time to get more or less records in the command line.

 

Found a great example of a Split Layout Screen which I would love to put into a web application:

http://tympanus.net/Blueprints/SplitLayout/