HOWTO: Gitignore for different Branches UPDATE

I have fixed my post from before with another method, I haven’t been able to figure out why it isn’t working (version maybe) but I also haven’t been able to reproduce it lately.

For those of you out there that have a GitHub account for an open source project, and another for hosting like Heroku, and have been faced with the fact that the traditional .gitignore in the root directory acts like an all or nothing for all your branches, and the manually adding each and every file that is need for the different branches and removing the ones that aren’t is annoying, and like every good programmer you are thinking, “there has to be a simpler automatic way of doing this.” Well there is!

start at $PROJECT_ROOT — this is where you did your git init

NOTE: Change your passwords in the private files info after doing this, if you have already committed with them, since an simple roll back will reveal them,

$ touch .gitignore
$ git add .gitignore
$ echo “path/to/secret/file.fake” > .gitignore
$ git commit “master branch gitignore”
$ git branch public_viewing
$ git checkout public_viewing
$ touch path/to/secret/file.fake
$ git rm path/to/secret/file
$ echo “path/to/secret/file” > .gitignore
[edit .gitignore to also remove/comment out the this line: path/to/secret/file.fake]
$ git add .gitignore
$ git commit -m “ignoring and removing the important info
Add the Repos — for ease I’ve made both repos public to Demonstrate

$ git remote add origin https://github.com/cognition/gitignore_demo_public.git
$ git remote add private https://github.com/cognition/gitignore_demo_private.git
NOTE: the naming origin vs private

$ git push origin -u public_viewing
$ git push private -u master

Now Private follows upstream master, and Origin follows upstream public_viewing

EXAMPLE REPOS

Public Version
https://github.com/cognition/gitignore_demo_public

Private
https://github.com/cognition/gitignore_demo_private

vola!

Now, when you do your commit and push to the remote public repo nothing that shouldn’t be seen (ie passwords) isn’t; but when you deploy with git all those needed passwords are there.

I hope this helps

MongoMapper with Devise

I just ran across this error:

/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/
  active_support/dependencies.rb:239:in require': 
  no such file to load -- devise/orm/mongo_mapper 
  (LoadError)

and after searching through Google I really didn’t see anything that pointed to this problem since 2009, so I figured it was just me and I was just no cool enough to be in the know.

So here is my solution for all those people out there that are in the same boat as me ;) When connecting MongoMapper with Devise, there is one little change you must do to the devise initializer, when you set up mongo_mapper in the beginning you put all your connection information in a file more than likely named like one of the two below:

config/initializers/mongo.rb 
  or 
config/initializers/mongo_mapper.rb       

So when you run this command:

$bundle exec rails g devise:install 

Devise adds another file to the initializers directory, in that file you will see this line: config/initializers/devise.rb

require 'devise/orm/mongo_mapper'

change it to below, and remember to use the name of the initializer that holds the mongodb connection information.

require 'mongo_mapper'  
# or 'mongo' whichever you said yes to for the initializer

now type:

$bundle exec rails g

and it should work with out any error of dependencies missing, assuming you installed everything right ;)


More Bash Laziness:

Add these lines to your bashrc or bash_profile if you use bundler, saves effort of typing too much:

alias br='bundle exec rails' 
alias brk='bundle exec rake' 
alias bi='bundle install'

and in case you for get all your alias (say cause you were on vacation), there is no reason you can’t build in a little cheatsheet.

alias aka='echo "
 br bundle exec rails
 brk    bundle exec rake
 bi bundle install"'

enjoy!

The best friend of the lazy command line warrior

alias

some of my favourite modifications to my .bashrc or .bash_profile files

the usual suspects:

alias ll='ls -l'
alias lla='ls -la'


for those ruby programmers out there that are using RVM:

alias 192='rvm use ruby-1.9.2'
alias 187='rvm use ruby-1.8.7'
alias jr='rvm use jruby'

…etc

for the lazy & forgetful that need a bit of a reminder and to start right away:

alias mproj='cd /path/to/project/root/ ; 192 ; git status'

because committing and pushing the same places is common

alias gitc='git commit -m ' #just remember to put in the comment "with the quotes"
alias hpush='git push heroku my_app master'
alias ghub='git push origin github_branch'
gitcom='git add . ; git commit' -m '


lazy sudo folks (not for everyone):
Ubuntu (apt)
alias apt-gets='sudo apt-get'
or

Fedora (yum)
alias yums='sudo yum'
or one step further
alias yumsi='sudo yum install'

if you find yourself always going to certain directories often:

alias etcd='cd /etc'

or the ssh one

alias sshuser='ssh user@domain.com -p' #(remove the -p flag if you have a blank passphrase with your ssh-keys)

Remember having to type too much or even taking your hand off the keyboard to use the mouse just smacks of effort.
Work smarter not harder!

HOWTO: Gitignore for different Branches

UPDATED

PLEASE SEE http://cogniton-mind.tumblr.com/post/63560840467/howto-gitignore-for-different-branches-update

Hello

[I know this a bit off topic but I believe this needs to be explained]

For those of you out there that have a GitHub account for an open source project, and another for hosting like Heroku, and have been faced with the fact that the traditional .gitignore in the root directory acts like an all or nothing for all your branches, and the manually adding each and every file that is need for the different branches and removing the ones that aren’t is annoying, and like every good programmer you are thinking, “there has to be a simpler automatic way of doing this.” Well there is!

start at $PROJECT_ROOT — this is where you did your git init

$ git branch public_viewing
$ cd .git/
$ touch info/exclude_public_viewing
$ echo "path/to/secret/file" > info/exclude_from_public_viewing

Now open the config file in your favourite editor (it’s in the .git/ folder) and add these lines under first heading [core]

excludesfile = +info/exclude

This line says that global ignore file is now in theinfo directory named exclude, so this where you put in all your log/* , *~ , etc..

Next go down to the end of the file (unless this branch already exists here) and add this:

** Fixed Error ** [local “public_viewing”] should read [branch “public_viewing”] or if you are only committing [remote “public_viewing”]

[branch "public_viewing"]
excludesfile = +info/exclude_from_public_viewing


and save.
Now all the gitignore stuff for that branch is all in the info directory named exclude_from_public_viewing

vola!

Now, when you do your commit and push to the remote public repo nothing that shouldn’t be seen (ie passwords) isn’t; but when you deploy with git all those needed passwords are there.

I hope this helps

Inference is nothing more than associated allusion

Inference is nothing more than associated allusion.

Every sentence is loaded with semantic content, that relies on inference to convey a message. In order to communicate between a pair of isolated aethers, each sphere must assume the other has within its data store a set of either the same or similar allusionary associations.

Often beyond the typical and obvious language differences, cultures and even generations often generate their own set of allusionary lexicons. Some examples that readily spring to mind are, ‘Winner’ to those approximately over 45 years of age now (in English speaking N. America), this term means one who wins their battles and has many successes, well liked and even admired by others, but to those younger than said age, will define it as someone who has very little success in their life and is often an outcast from the social norm. Notice that the semantic elements are related simply reversed, also that the modern usage does not co-inside with the dictionary definition.

Polymorphic semantics (aka etymology) is a fascinating study that can grant a deeper understanding of the semantic undertones that give rise to miss-communication and non-cohesive allusionary associative assumptions [alliteration intended].

To demonstrate this point I will recount a scene from memory - (other definitions in curly { brackets } )

Back in University I was dinning at my favourite greasy spoon {dinner} ingesting my daily intake of artery clogging delights {3 fried eggs, with bacon, sausage and fried hash browns}. When a elderly gentleman entered and took up the booth across the aisle from me. Soon Cheryl, the bubbly waitress - wearing her usual low cut tight blouse (presumable to foster the looser wallets and higher tips), arrived at the gentleman’s table to take his order.

He said, “I’ll have the special and dim the head lights.”

Immediately, Cheryl blushed and became self-conscious of what she was wearing and checked to make sure her blouse was still done up, then turned back to the gentleman with the intention of berating him (like I had seen many times before). I, noticing Cheryl’s boiling point {getting angry}, as well as having heard the gentleman’s order, I piped in {interjected into the conversation - vocally} and rescued the old man from a severe tongue lashing {stern and sometimes degrading lecture} I translated ‘dim the headlights’ for her, explaining that he wants his eggs over easy, adding its good thing he did want them with the ‘high beams blazing’ {sunny side up}.

This little story is a great example of how sayings and references have different semantic elements attached to them within an individual’s aethereal sphere. Frames of reference and sets of subjects are kept within the mind (like a computers RAM or SWAP). This how and why in many situations occasions of miscommunication occur. So be aware of this subtle differences in semantic under tones when communicating with others, or especially when designing common knowledge base ontologies.

Time to Get Started

Hello,

This Blog is about Language and Natural Language Processing, perhaps a few tips and tricks that I may find useful to send along.

I Hope whomever reads this, enjoys it!

cognition.mind
{AKA Ramon Brooker}