<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
   <channel>
      <title>Continuously Deployed Dan Mayer&apos;s Dev Blog</title>
      <link>http://www.mayerdan.com/</link>
      <description>Continuously Deployed is a dev blog focused mostly on startups, lean techniques, Ruby, Javascript, mobile dev and easing the development process.</description>
      <language>en</language>
      <copyright>Copyright 2012</copyright>
      <lastBuildDate>Sat, 14 Jan 2012 14:42:37 -0700</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

      
      <item>
         <title>Rails tests gotcha with I18n.locale</title>
         <description><![CDATA[A example of a bad I18n rails test... Found some tests failing in a project because tests in different files would change I18n.locale, changes like this make your tests fail if the tests are not run in the standard order. since this took me awhile to track down, I thought I should share a quick example for others to find. So if you are having a issue like this remember to add a teardown method that resets I18n.locale to the default local.

<script src="https://gist.github.com/1568648.js?file=I18n_bad_test.rb"></script>]]></description>
         <link>http://www.mayerdan.com/2012/01/rai.php</link>
         <guid>http://www.mayerdan.com/2012/01/rai.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Rails</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Ruby</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Testing</category>
        
         <pubDate>Sat, 14 Jan 2012 14:42:37 -0700</pubDate>
      </item>
      
      <item>
         <title>Ruby processing: making it snow</title>
         <description><![CDATA[I re-found a fun holiday project I did a couple years ago <a href="https://github.com/danmayer/Processing-Snow">making snow with Ruby processing</a>.

<a href="http://www.mayerdan.com/snow-processing.jpg"><img alt="snow-processing.jpg" src="http://www.mayerdan.com/assets_c/2011/12/snow-processing-thumb-500x312-49.jpg" width="500" height="312" class="mt-image-none" style="" /></a>]]></description>
         <link>http://www.mayerdan.com/2011/12/ruby_processing_making_it_snow.php</link>
         <guid>http://www.mayerdan.com/2011/12/ruby_processing_making_it_snow.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">graphics</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">processing</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">ruby</category>
        
         <pubDate>Tue, 27 Dec 2011 14:42:06 -0700</pubDate>
      </item>
      
      <item>
         <title>Cleaning up files after hacking</title>
         <description><![CDATA[This blog was hacked awhile ago. It was annoying, I hadn't updated my blog software for awhile and there was a security hole. It was a good learning experience of how to deal with the intrusion. It was also nice to be able to quickly whip together some scripts to help clean everything up. 

This let me see which files were recently modified
<code>
find . -type f -mtime -3 | grep -v "/Maildir/" | grep -v "/logs/"
</code>

The exploiters were modifying my .htaccess and adding a few files of their own, this deleted their files
<script src="https://gist.github.com/1491781.js?file=gistfile1.txt"></script>

This code helped remove exploit code that was injected into all of the pages on the site.
<script src="https://gist.github.com/1491783.js?file=remove_code.rb"></script>

After upgrading my software and installing security patches, a bit of other cleanup, and file permission fixes everything was back to normal.

]]></description>
         <link>http://www.mayerdan.com/2011/12/cleaning_up_files_after_hackin.php</link>
         <guid>http://www.mayerdan.com/2011/12/cleaning_up_files_after_hackin.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">General</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Resources</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">admin</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">system</category>
        
         <pubDate>Sat, 17 Dec 2011 16:07:22 -0700</pubDate>
      </item>
      
      <item>
         <title>ActiveRecord / Rails case insensitive ordering</title>
         <description><![CDATA[It is pretty common to want to have the results of a query sorted by order. I wanted the results sorted by name on a user object. Oddly it is hard to find how to make a string based order case insensitive on google. So for other having the same issue, it is simple, just add lower(field) in the order clause and it will sort in a case insensitive manner. Now I don't care when a user doesn't capitalize the first letter of their name.

<code>
User.order('lower(name)').all 
</code>]]></description>
         <link>http://www.mayerdan.com/2011/11/activerecord_rails_case_insens.php</link>
         <guid>http://www.mayerdan.com/2011/11/activerecord_rails_case_insens.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Activerecorder</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Rails</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Ruby</category>
        
         <pubDate>Wed, 16 Nov 2011 19:56:39 -0700</pubDate>
      </item>
      
      <item>
         <title>Announcing NothingCalendar</title>
         <description><![CDATA[I wanted a small project to play around with. A project that was small and simple that I could actually get done in my free time. An app I would use myself. I ended up deciding to build <a href="http://nothingcalendar.com">NothingCalendar</a>, which was inspired by <a href="http://calendaraboutnothing.com">CalendarAboutNothing</a>. It let's users track events, anything they feel like tracking over time. Mark off days you worked out, kept to your diet, worked on writing, studied, quit smoking, or anything else.

The idea was a simple way that I could add marks on a calendar on my phone, and have it sync-able and shareable. I also wanted it to be useable when you are offline, since phones loose connection often in metros, planes, lines, etc.

One goal with the project is to keep it is small enough that I can build it and play around with different ideas. It is such a small app, that I could rewrite the entire thing with a new methodology if I wanted. Which is exactly what I plan on starting to do. I wanted a app that I could practice new skills and techniques on, while still being useful, and something I would use on a day to day basis.

I started working on the project with the idea to build up a chain of doing some open source experimental development having a playground to try things and learn. A small app where I could push myself to look at new technologies, and to force myself to release them into a production environment, opposed to another one off script or tests that never see the light of day. I highly recommend forcing yourself to do a bit of development every day, it is recommended by a bunch of smart people (<a href="http://pragprog.com/the-pragmatic-programmer">Andrew Hunt and David Thomas's The Pragmatic Programmer: From Journeyman to Master</a>, <a href="http://www.amazon.com/Passionate-Programmer-Remarkable-Development-Pragmatic/dp/1934356344">Chad Folwer's The Passionate Programmer</a>, <a href="http://www.amazon.com/Hackers-Painters-Big-Ideas-Computer/dp/0596006624">Paul Graham's Hackers and Painters</a>). I was in part inspired by <a href="http://twitter.com/#!/eee_c">Chris Strom (@eee_c)</a>, who has done incredible work keeping up a chain and blogging about what he learns. 

NothingCalendar is a testament to what you can do in about 15 minutes a day. That is about how much time I have spent on it most evenings. Just forcing myself to do a bit every day, has led to my longest <a href="http://calendaraboutnothing.com/~danmayer">streak on CalendarAboutNothing</a> (66 days at the moment). Just remembering to code a bit everyday, keeps the project in your mind, keeps you improving it. It also makes refactoring little things a perfect task, you only have a few minutes take something on.  Complete a tiny refactoring of from a todo list and check it in. I frequently just check in #TODO comments, and grep for them when I don't have much time or an idea of what to work on. After a tiny todo, call it a day and know you will have more time sometime soon to do something more substantial. 

Please give NothingCalendar a try, and let me know how it goes or any problems / feature ideas. I will will be working more more on it each day, and trying to rewrite large parts of the app using some new ideas.]]></description>
         <link>http://www.mayerdan.com/2011/11/announcing.php</link>
         <guid>http://www.mayerdan.com/2011/11/announcing.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">General</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Mobile</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">learning</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">projects</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Rails</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Ruby</category>
        
         <pubDate>Mon, 14 Nov 2011 19:16:30 -0700</pubDate>
      </item>
      
      <item>
         <title>working with Facebook  Dialog Feed and urls with params</title>
         <description><![CDATA[Facebook's documentation always sucks. There are many examples of working with facebooks dialog feed, but none of them include passing urls that have params. They are all simple examples like share 'http://example.com', well if you want to share 'http://example.com?foo=bar&buzz=baz' you are kind of out of luck. It took me far longer than I care to admite to figure out the right way to get facebook to share a link that included params.

I was using ruby and rails, creating a link with _url and params, and then trying to encode it and send it to facebook. Below is what ended up working. Note that it seems to be a bit of an odd encoding, but it allows one to send urls with params and encoded '?' and '&' properly through facebook and have the share url include the params your expecting.

<code>
facebook_shared_url = action_url({:foo => 'bar', :buzz => 'baz'})
facebook_url = "https://www.facebook.com/dialog/feed?app_id=#{FACEBOOK_CLIENT_ID}&redirect_uri=#{URI.encode(facebook_shared_url).gsub('&amp;','%26')}&description=#{text}&name=#{via}&link=#{URI.encode(facebook_shared_url).gsub('&amp;','%26')}"
</code>]]></description>
         <link>http://www.mayerdan.com/2011/11/working_with_facebook_dialog_f.php</link>
         <guid>http://www.mayerdan.com/2011/11/working_with_facebook_dialog_f.php</guid>
        
        
         <pubDate>Sun, 13 Nov 2011 12:26:57 -0700</pubDate>
      </item>
      
      <item>
         <title>Grep a filtered list of files</title>
         <description><![CDATA[I am working on a project that has view formats. Frequently when grepping the project, I want to grep only one format. I added a couple bash aliases to help me pipe a list of files to grep. Grepping through a specific list of files can be useful in many situations. Here is how to grep a list of files or set up quick aliases to make it easy to do.

First you need to get a list of files, in my case I do this with find and looking for the touch format

<code>
alias find_touch_views='find app/views/ -name "*.touch.erb"'
</code>

This generates the list of files you want to grep, now you just pipe that list to grep using xargs to grep each file for a specific word.

<code>
alias grep_touch_views='find_touch_views | xargs grep -Ri "$0"'
</code>

in the end this lets me run

<code>
grep_touch_views touch-nav 
</code>

Modify these to fit your needs and add them to your ~/.bash_profile

<code>
alias find_touch_views='find app/views/ -name "*.touch.erb"'
alias grep_touch_views='find_touch_views | xargs grep -Ri "$0"'
</code>

which gives me a list of all the views that contain touch-nav.]]></description>
         <link>http://www.mayerdan.com/2011/11/grep_a_filtered_list_of_files.php</link>
         <guid>http://www.mayerdan.com/2011/11/grep_a_filtered_list_of_files.php</guid>
        
        
         <pubDate>Sat, 12 Nov 2011 10:45:48 -0700</pubDate>
      </item>
      
      <item>
         <title>Git clone from local filesystem to fetch local branches</title>
         <description>So I am working on a project that has a very long test suite. Yes, that is a problem and we should start to do something about it. For now that problem exists but it leads to wanting to do some weird things. I wanted to work on code in a branch, while my tests were running in another. I had cloned the project twice so I had two versions, of the project, the issue was the branch I wanted to work in hadn&apos;t been pushed remote. I then realized since it is git I could easily solve the problem by pointing my second version of my project at the first and fetching all of my local branches! Git is pretty great that you can solve things like this. It also means you could easily just run git off a shared network filesystem, no reason to really setup a fancy git server.

Here are the steps make a second version of a project and then fetch the local branches from your first version

# if you haven&apos;t clone a second version of the project do that from the filesystem or the git server
&gt; cd project_2
&gt; git clone /Users/danmayer/projects/project_1
&gt; Cloning into project_1...

# in the second version of your project add a remote repo pointing at the original version of the project on your filesystem
&gt; cd project_1
&gt; git remote add local /Users/danmayer/projects/project_1/
&gt; git fetch local
&gt; git branch #=&gt; a list of the branches on your first projects directory

This is a pretty simple thing to do, but when I ran into the issue it took me a bit of time to realize how simple it was to solve this problem. It also just illustrates just how versatile git really is.</description>
         <link>http://www.mayerdan.com/2011/10/git_clone_from_local_filesyste.php</link>
         <guid>http://www.mayerdan.com/2011/10/git_clone_from_local_filesyste.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">General</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Resources</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">environment</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Git</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Github</category>
        
         <pubDate>Sat, 29 Oct 2011 14:34:49 -0700</pubDate>
      </item>
      
      <item>
         <title>Simplifying new gemset creation for RVM</title>
         <description><![CDATA[I found myself annoyed that each time I created a new project I had to go through the same steps to create and setup my gemset. I am also trying to be better about automating things I do over and over. I decided I should put something in my .bash_profile to simplify my frequent task of making a new gemset on a brand new project. 

The manual way I ended up creating gemsets in the past, was:
* cd to project_directory
* rvm use ree (my preferred local ruby run time)
* rvm gemset create projectGemSet
* echo 'rvm use ree@projectGemSet' > .rvmrc
* cd ../
* cd project_directiory
* agree to trust the .rvmrc file

That is pretty simple, but gets a bit annoying to do over and over. I figured I could very quickly whip up a solution in my bash profile. Unfortunately, due to my shell scripting skills kind of sucking, I ended up using Ruby.

Basically after adding my new ruby script to my .bash_profile, I can now just type 'init_gemset newgemset', and I will be left in my project using my new gemset. The final script is below.

<script src="https://gist.github.com/1257690.js?file=init_gemset.rb"></script>

One thing to note is the time saved with automating a repetitive task vs. time spent to automate it. In the end because of spending a decent amount of time trying to write this as a shell script without using Ruby. I likely spent more time getting this script working, than it will ever save me. It also isn't even fully reusable for other people in it's current state (the .bash_profile function needs a full path to the ruby script in it, and my preferred RVM ruby is hard coded). It could be made more easily reusable / sharable (likely making it a gem, or sending a pull request to RVM itself with this as a feature). Doing this the fully 'right' way would just add more time spent, on something I initially did to save a few moments.

I wanted to get back to what I was originally working on, and I had something that would work for me. So I will leave it here as a simple gist. Working on this also made me think about what is worth spending time automating. In terms of savings this likely wasn't worth much, but there are many times that a repetitive task is really begging for automation.]]></description>
         <link>http://www.mayerdan.com/2011/10/simplifying_new_gemset_creatio.php</link>
         <guid>http://www.mayerdan.com/2011/10/simplifying_new_gemset_creatio.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Development</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">environment</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">ruby</category>
        
         <pubDate>Sun, 23 Oct 2011 18:41:11 -0700</pubDate>
      </item>
      
      <item>
         <title>ActiveRecord Association objects can act weird (bug in association#any?)</title>
         <description><![CDATA[I found a weird issue when working with <a href="http://apidock.com/rails/ActiveRecord/Associations/AssociationProxy">ActiveRecord AssociationProxy objects</a>, they weren't proxying the method correctly.

The issue arose when trying to use the #any? method on an array which should be true when empty. When calling this on a AssociationProxy object that has 0 items it was returning false. Oddly enough inspecting or to_s the association and then calling #any? resulted in the correct behavior. It was so weird though that after looking at other options I ended up using the present?, which always behaved how I expected it to. Even weirder is the issue only presented itself in the rails server debug and production modes. It always acted as one would expect in rails console. I started to dig in more, but ended up yak shaving a lot of other stuff to try to learn exactly what the cause was. If anyone understands the issue better, I would be happy to know more.

Until then, be aware that at least in the 2.3.X versions of rails, ActiveRecord AssociationProxy#any? acts funky and should not be trusted. Use a work around like present? or length > 0 (both worked correctly in console and on dev/production server environments). This is one of these issues where there is so much going on in the rails stack that it is hard to determine where the issue lies.

So for those googling this issue, beware AssociationProxy.any? on has_many relationships.

Example code:
<script src="https://gist.github.com/1250980.js?file=AR_bug.rb"></script>]]></description>
         <link>http://www.mayerdan.com/2011/10/activerecord_association_objec.php</link>
         <guid>http://www.mayerdan.com/2011/10/activerecord_association_objec.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Bugs</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Rails</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Ruby</category>
        
         <pubDate>Sun, 02 Oct 2011 12:58:46 -0700</pubDate>
      </item>
      
      <item>
         <title>Google Closure Compiler And Ruby</title>
         <description><![CDATA[I have repeatedly needed to compress / minify a collection of javascript files. Which I had been doing by hand with <a href="http://closure-compiler.appspot.com/home">Google's closure compiler</a>. I started to get annoyed with this process and went looking for a better solution. If you are using Rails, there is a great solution using <a href="http://documentcloud.github.com/jammit/">Jammit</a> asset packager library for Rails. I was not using rails, and just needed something that could write the files on demand. A bit of quick searching came up withh this post <a href="http://tinyhippos.com/2010/01/08/compressing-javascript-code-with-google-closure-compiler-and-ruby/">Compressing Javascript Code With Google Closure Compiler And Ruby</a>. It basically met my needs, but needed to be modified a bit to take a collection of files and write that collection of compresses files back to disk.

Here is the solution I ended up with:

<script src="https://gist.github.com/1063584.js"> </script>


]]></description>
         <link>http://www.mayerdan.com/2011/07/google_closure_compiler_and_ru.php</link>
         <guid>http://www.mayerdan.com/2011/07/google_closure_compiler_and_ru.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Resources</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">ruby javascript closure minification compression</category>
        
         <pubDate>Mon, 04 Jul 2011 10:22:37 -0700</pubDate>
      </item>
      
      <item>
         <title>Emacs swap buffer window method</title>
         <description><![CDATA[So I really like split screen in emacs. I am in that mode pretty much all the time. One thing that annoyed me was opening a file on the side of the screen I wanted. Sometimes I want code left, tests right others it is project A left project B right or often server code left, client code right. Anyways I often opened a file on the wrong side of the screen and wanted to move the buffer. Previously I always closed the buffer, then switched to the other emacs window (C-x o) then reopened the file. This annoyed me to know end, so I finally went looking for a solution. I found something that was close, but not what I wanted, which <a href="http://stackoverflow.com/questions/1774832/how-to-swap-the-buffers-in-2-windows-emacs">swaps two buffers positions left and right</a>, so I started with that code and modified it to do just what I want. I then bound the function to "C-x /" which wasn't in use and I can now swap buffer windows with ease. Also, kind of fun to do a bit of lisp/emacs hacking and breaking out of my Ruby world a bit.

<script src="https://gist.github.com/1009137.js?file=swap_buffer_window.el"></script>

If you notice I have it also close the current tab for the buffer and move the cursor context to the new buffer on the other side of the screen. Most people hate and don't use tabs in emacs so that one tab closing could be commented out. I love tabs because I am a very spacial person and the tabs let me keep the physical location of the buffers in my head. This was written to run in Aquamacs, but will work equally well in standard emacs. Just drop it in your .emacs file or emacs config directory. 

Code can be found at this gist, <a href="https://gist.github.com/1009137">Emacs swap buffer window</a>]]></description>
         <link>http://www.mayerdan.com/2011/06/emacs_swap_buffer_window_metho.php</link>
         <guid>http://www.mayerdan.com/2011/06/emacs_swap_buffer_window_metho.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Resources</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Aquamacs</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Editors</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Emacs</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Lisp</category>
        
         <pubDate>Sun, 05 Jun 2011 10:50:24 -0700</pubDate>
      </item>
      
      <item>
         <title>Fix: Emacs/Aquamacs keeps adding encoding comments to my files</title>
         <description>I had a problem, when I had files of weird encodings or unknown encodings emacs would add a stupid comment at the top  # -*- coding: &quot; coding-system &quot; -*- where coding-system was the detected encoding, such as # -*- coding: utf-8 -*-

I found this a big problem because it would add it to my erb files, which in turn would actually display the comment on the HTML, because # isn&apos;t a valid html comment... Actually that it was trying to comment it was a hint of where this was occurring so I could disable it.

It turns out it was ruby-mode for emacs that was adding this stupid comment &apos;on my behalf&apos; against my wishes...

So now that I knew what was causing it, it was time to fix the problem.

Just edit the ruby-mode emacs file, force it to recompile and use emacs without it screwing up your files...

On my system the files was here, but it will be in your emacs folder wherever you keep it.
`emacs /Users/danmayer/.emacs.d/elpa/ruby-mode-1.1/ruby-mode.el`

Then comment out this code (note that ;; is a comment for lisp):
;; (defun ruby-mode-set-encoding ()
;;   &quot;Insert a magic comment header with the proper encoding if necessary.&quot;
;;   (save-excursion
;;     (widen)
;;     (goto-char (point-min))
;;     (when (re-search-forward &quot;[^\0-\177]&quot; nil t)
;;       (goto-char (point-min))
;;       (let ((coding-system
;;              (or coding-system-for-write
;;                  buffer-file-coding-system)))
;;         (if coding-system
;;             (setq coding-system
;;                   (or (coding-system-get coding-system &apos;mime-charset)
;;                       (coding-system-change-eol-conversion coding-system nil))))
;;         (setq coding-system
;;               (if coding-system
;;                   (symbol-name
;;                    (or (and ruby-use-encoding-map
;;                             (cdr (assq coding-system ruby-encoding-map)))
;;                        coding-system))
;;                 &quot;ascii-8bit&quot;))
;;         (if (looking-at &quot;^#![^\n]*ruby&quot;) (beginning-of-line 2))
;;         (cond ((looking-at &quot;\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)&quot;)
;;                (unless (string= (match-string 2) coding-system)
;;                  (goto-char (match-beginning 2))
;;                  (delete-region (point) (match-end 2))
;;                  (and (looking-at &quot;-\*-&quot;)
;;                       (let ((n (skip-chars-backward &quot; &quot;)))
;;                         (cond ((= n 0) (insert &quot;  &quot;) (backward-char))
;;                               ((= n -1) (insert &quot; &quot;))
;;                               ((forward-char)))))
;;                  (insert coding-system)))
;;               ((looking-at &quot;\\s *#.*coding\\s *[:=]&quot;))
;;               (t (when ruby-insert-encoding-magic-comment
;;                    (insert &quot;# -*- coding: &quot; coding-system &quot; -*-\n&quot;)))
;;               )))))

;;  (add-hook
;;    (cond ((boundp &apos;before-save-hook)
;;           (make-local-variable &apos;before-save-hook)
;;           &apos;before-save-hook)
;;          ((boundp &apos;write-contents-functions) &apos;write-contents-functions)
;;          ((boundp &apos;write-contents-hooks) &apos;write-contents-hooks))
;;    &apos;ruby-mode-set-encoding)

Finally, delete the compiled file forcing it to recompile the plugin next time emacs is opened... on my system:
`rm /Users/danmayer/.emacs.d/elpa/ruby-mode-1.1/ruby-mode.elc`

That&apos;s it, no more encoding comments in your files... The rest of ruby-mode continues to work, and you will have less urges to throw your computer out of the window.

Don&apos;t worry, I still like you pretty well emacs, although it seems the whole world is moving to Vim, and if Textmate-2 is ever released, your cryptic ways may come to an end. Yes you can do anything, but I can&apos;t make you always do what I want.</description>
         <link>http://www.mayerdan.com/2010/10/fix_emacsaquamacs_keeps_adding.php</link>
         <guid>http://www.mayerdan.com/2010/10/fix_emacsaquamacs_keeps_adding.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Aquamacs</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">editor</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">emacs</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">ruby</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">ruby-mode</category>
        
         <pubDate>Wed, 13 Oct 2010 19:54:39 -0700</pubDate>
      </item>
      
      <item>
         <title>Force all Sinatra traffic to https</title>
         <description><![CDATA[I wanted to have all traffic on a site go through https. Since the site was on heroku. <code>@env['rack.url_scheme'])=='https'</code> wasn't a sufficient way of detecting if on https. You need to also check <code>(@env['HTTP_X_FORWARDED_PROTO']</code>. Below I wrote a simple before filter which you could place in the production configuration. After talking with the author of rack-ssl-enforcer I got that patched to work on heroku as well. So that is an even simpler option. 

Anyways, I spent far to long googling sinatra https, sinatra ssl, sinatra over https, sinatra secure, and heroku https, and couldn't find good pages on this for awhile. So here is the info for anyone else wanted to host secure Sinatra pages on heroku.

<script src="http://gist.github.com/512887.js?file=sinatra_https_redirect.rb"></script>]]></description>
         <link>http://www.mayerdan.com/2010/08/force_all_sinatra_traffic_to_h.php</link>
         <guid>http://www.mayerdan.com/2010/08/force_all_sinatra_traffic_to_h.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Ruby</category>
        
        
         <pubDate>Sat, 07 Aug 2010 09:18:17 -0700</pubDate>
      </item>
      
      <item>
         <title>Adding Custom JavaScript Handlers for PhoneGap Android</title>
         <description><![CDATA[One of the advantages I mentioned about PhoneGap, was being able to write custom native code, and interface with it via JavaScript. Their Aren't great example of how to do this out there, so I figured a quick blog post was in order.

I search around for how to do this when getting started with PhoneGap, and the best example I could find was, <a href="http://www.somms.net/2010/05/28/native-messages-for-android-phonegap/">Native messages for Android PhoneGap</a>. Following this example, I was able to get my own Javascript interface working.

Basically you create a class (using java for android example):

<script src="http://gist.github.com/470919.js?file=CustomJS.java"></script>
I 
create this private class in the main Java class which extends DroidGap (the class that boots up PhoneGap and creates the webview UI).

<script src="http://gist.github.com/470920.js?file=extendDroidGap.java"></script>

Then in your html you can call in javascript bridged Java functions like <code>var myData = CUSTOM.getData();</code> which will return the java data (in this case a string) to the javascript. I have used the JS bride to begin new Android Activities, Close the WebView and move entirely to Native code. Background the WebUI to do something native for awhile, then return the WebView back to the front, Etc.

<script src="http://gist.github.com/470922.js?file=customJSPhoneGap.js"></script>

This can be done similarly for the iPhone and Objective-C to Javascript with PhoneGap. This lets you leverage extra native flexibility while still building the majority of your app as JS, CSS, and HTML.]]></description>
         <link>http://www.mayerdan.com/2010/07/adding_custom_javascript_handl.php</link>
         <guid>http://www.mayerdan.com/2010/07/adding_custom_javascript_handl.php</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">Computer Science</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">Mobile</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Android</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">iPhone</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Java</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">javascript</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">Mobile</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">PhoneGap</category>
        
         <pubDate>Sat, 10 Jul 2010 12:02:41 -0700</pubDate>
      </item>
      
   </channel>
</rss>

