Around this time last year git added a "smart" HTTP transport that is faster than the old HTTP transport (and in some cases faster than SSH too). And a few months later GitHub added support for this new HTTP transport and made it the default selected url for repositories (that you aren't a contributor for).
There aren't any major advantages using https over ssh to access your GitHub repositories, it's just more simple to use your username/password instead of adding your ssh key. The only other advantages is that it's easier to set up HTTP proxy for git (
git config --global http.proxy proxy:8080 vs ssh config) and being able to use more than one GitHub account (which you shouldn't since anyone can add you as a contributor to a project).
One major disadvantage is that it asks you for your username/password each time you interact with your remote repository (clone, pull, push, etc). To solve this, I decided to write a program that stores your username and/or password in your keychain so git will ask once for you username/password and retrieve it later so you don't have to type it again. If you only want the program, skip to it.
Continue reading "Store your git https passwords in your OS X Keychain"
using statement is an extremely useful feature of C# and it's quite disappointing that Phidgets did not implement
IDisposable. Thankfully it's fairly easy to create a wrapper for any Phidget that implements it so we can simply some code.
Continue reading "Using ‘using’ with Phidget’s C# Library"
One cool package for playing around with your phidget(s) is
mono-csharp-shell which gives you an interactive C# shell (with tab completion).
apt-get install -y mono-csharp-shell
Once the package is installed, you can open it with
csharp but just like with
gmcs we have to include the reference to the Phidget library.
Continue reading "PhidgetSBC2 Interactive C# Shell"
Since we cannot install
mono-complete on the PhidgetSBC2 currently, we are missing some of the C# namespaces. If you are trying to use any of the following namespaces and
gmcs cannot find it, you will have to install the respective package.
So this Monday my PhidgetSBC2 arrived and I was super excited to get started playing around with the short-term goal of being able to open my door lock remotely.
I really wanted to write the code in C# because it's simply better than Java and it's lot easier to implement a server in C# than in C. While the manual for the SBC2 says you can get Mono working if you install the correct packages, I couldn't find any information on the Phidget website on how to do it, so I had to figure it out myself.
Continue reading "Using Mono on the PhidgetSBC2"
With some recent commits to rails comes the ability to have a
default_scope with a lambda that gets evaluated at query time. Combine that with a multi-tenant column scoped database structure (wow, quite the mouthful) and you've got an quick and painless way to partition your tenant data without scattering code everywhere.
Continue reading "Simple Rails Multi-Tenancy"
The methods that come with the standard
ActionPack::Helpers::FormBuilder cover most cases of what you need to do but if you need to do something it doesn't have a method for, things can get a little ugly.
In my case I wanted to create a helper for autocompleted fields that all had the same attributes but different arguments (the urls).
data-autocomplete, normally when you wanted to have the field autocompleted, you would pass in the attribute to the form helper
f.text_field :username, :'data-autocomplete' => users_path(:json)
While there is nothing bad about doing this, you end with a bunch of
:'data-autocomplete' scattered about in your views which makes it harder to change down the road if you were to switch your JS implementation.
A nicer way is to have your own form builder method called
autocomplete_field which requires two arguments (
url) that adds the
:'data-autocomplete' option (which is now in one place and easily changed) for you. Best part is this can be done with only one helper file.
Continue reading "Playing with FormBuilder"
With my current gaming rig nearing its 4th birthday, it's time to look at a new one. With a nice amount saved up, I'm going for very good rig.
Continue reading "Time for a new computer"
Every blog needs a first post and I can't think of an exiting topic to make it about so I'll just say: hi.