Skip to main content

Speeding up CraftCMS on Heroku

So, I previously blogged about how we hosted CraftCMS on Heroku. When we built the marketing site for Quala the twig templates were built for maximum authoring flexibility at the cost of some TTFB problems. We knew this going into the project. In an ideal world we would use GatsbyJS to build the frontend, but we very limited in time. When we went live, we saw a dramatic improvement to First Contentful paint, but a huge decrease to Time To First Byte, averaging at 1.3 seconds.

Continue Reading

Building a remote cache server for Turborepo

Turborepo is a tool that came across my virtual desk recently. Monorepo develoment has been around for a long time. This is a strategy where all of your code remains in one repository regardless of services. A lot of people use monorepo's even for microservices. The huge upside is to keep everything in one place, which allows for development efficiency, such as grepping an entire codebase for specific keywords. A quick example would be a top level directory which has child directories that each contain an npm package, unlike publishing these packages, you access them locally as though they were published.

Continue Reading

Hosting dotnet core on Heroku

I've been getting back into building scrappy little web apps for my friends. On top of this, I recently joined a startup and getting away from Enterprise class software has made me make a huge mind-shift. In the recent past when I wanted to build apps I was thinking Kubernetes, Helm Charts, etc. However, in small app, and startup land reducing the barriers to ship is very important.

Continue Reading

Accessibility Driven Development

I've been working at CarGurus.com for the last 2 years or so. One of the biggest journeys we've been undertaking is to take accessibility far more seriously. However with an engineering team way into the triple digits it gets harder and harder to scale accessibility knowledge.

Continue Reading

Taking time away

In case you haven't notice, this blog has not gotten updates much this summer. Some people have even noticed the overall lack of activity on my GitHub. Emails have gone, several weeks unanswered.

Continue Reading

Dockerize that old webforms app

So now that Windows server 2016 is generally avalible for the first time ever windows users can now use containers. Ok, so what exactly are containers? Well more or less they are virtual operating systems that share the same kernel as the host OS. In regular VM's the hardware is shared between machines, but containers go a step further and share the kernel of the OS. Why does this matter? Well because you are sharing an existing kernel that is already running, your startup times are instantanious. To put this in perspective, this is virtualization at the OS level.

On Linux, containers have been a thing for a long time. This technology is called LXC. Docker itself is a layer ontop of various container platforms embedded in operating systems.

Continue Reading

Commiting a new file to git, through the github api

Recently I have been working on an application that basically has a github bot (aka user) fork a repo, commit some files, and submit a PR against someone's repo. When it came down to actually making a new git commit through the github API, I had quite a hard time. I figured it out with some help from a ruby tutorial, and now I'm going to show you how to do it.

Continue Reading

Migrating Ghost blog to hexo

I recently ported my ghost blog to hexo, and it was pretty easy.

Checkout my other hexo blogs:

Getting Started with hexo

To get started with hexo run the following commands:

  • npm install -g hexo-cli
  • hexo init
  • npm install

This will drop many files, and folders. The primary one we are going to talk about is the _config.yml. You will want to start by filling out the _config.yml file. Name your blog, give a descripton, etc.

Porting your blogs over

To get your data over you will need to go to this url: http://yourblog.com/ghost/settings/labs/ and click the export button. Place the json file at the root of your hexo blog, then run.

  • npm install hexo-migrator-ghost --save
  • hexo migrate ghost NameOfYourExportFile.json

Your posts should drop in the posts folder, but the tags will need fixing. Open atom (or another editor that can do find replace in a directory) and replace tags: | with tags: in all the files.

Now that it is done we need to fix the paths to your images. Download your images (if you are using azure you can get them via ftp), and place the folder in the source directory.

Now run hexo server, browse to port 4000. Your blogs should appear.

Backward compat. urls

We need to make some modifications to make sure the urls are backward compatible.

Set the tag_dir to tag, in ghost the path to tags is /tag.

if your post urls were just /Title then put :title/ in the permalink setting. Otherwise adjust the urls for the proper date format.

RSS

You will want to have an rss feed. You will want to npm install hexo-generator-feed --save

You can then add the following to your config.yml

feed:
    type: rss2
    path: rss
    limit: 0

If you were like me you registered your ghost rss feed to /rssinstead of /rss.xml. I have no perfect answer to fix this, but I used azure's Url redirect to redirect /rss to /rss.xml.

<configuration>
  <system.webServer>
    <rewrite>
          <rules>
              <rule name="SpecificRewrite" stopProcessing="true">
                  <match url="^rss$" />
                  <action type="Rewrite" url="public/rss.xml" />
              </rule>
          </rules>
  </system.webServer>
</configuration>

If you are using github pages you can use the jekyll-redirect-from gem.

Continue Reading

Hosting hexo in azure webapps

If you have read this blog for any length of time, you know I am a fan of Azure. I thought about using github pages with hexo, but github pages only supports 1 doman name. I could start 301 redirecting my other domains, but I really didn't want to do that.

Continue Reading

Razor Websites, lightweight C# web coding

I was exploring around github, and I stumbled upon an interesting project called Miniblog which was a lightweight blog engine written in c#. The thing that immediately stood out to me was the lack of a .csproj file.

As I dug around the code I realized this was not a Web App, which most of us were familiar with, but a websites project. I then suddenly realized that the whole thing only used razor!

I am a huge fan of Nancyfx because its much more lightweight than the MVC framework created at Microsoft. To say the least I am a massive fan of small tools, and micro frameworks. So when I realized this whole thing was powered by razor only I was immediately impressed.

I decided to dig around on the internet to see if anyone else was talking about this. I found out quickly that it has been possible for some time, but I didn't find many references about it.

The one thing that bummed me out about the Miniblog example was that it was not a web app. You can use nuget packages will websites, but you cannot make references to other projects in the solution. This was a problem for me, and unlike websites, web app's are precompiled which reduces application startup time.

Continue Reading

Saying goodbye to my VPS (..and my opinions of cloud providers)

I have used Linode for quite a long time now. My blog was hosted on linode, as was my StarBound server. My linode was the CentOS Pet I always wanted. Full of manual Fail2Ban configs, I make sure I fed my VPS every day. I even used cowsay to give me a cool message from my pet every login.

The major reason I moved my things away from Linode, was not the devops story itself. I could have stuck with linode, and used chef or something to manage my former friend. I decided to host everything in Azure Web apps. Now before I give you my long ramblings why I like azure; I must tell you. I put everything in azure, because my MSDN gave me free credits. There was no huge scientific analysis behind this. The simple fact that I got free money in Azure was the only reason why I started using it.

Continue Reading

Abstracting Xamarin Android SharedPreferences

The standard way to get/set SharedPreferences in Xamarin is with the following code.

Get Preference:

var shared = con.GetSharedPreferences(_preferenceName, FileCreationMode.WorldReadable);
 var value = shared.All.Where(x => x.Key == key).FirstOrDefault().Value;

Set Preference:

var shared = con.GetSharedPreferences("PreferenceName", FileCreationMode.WorldWriteable);
            var edit = shared.Edit();
            edit.PutString(key, val);
            edit.Commit();

The main issue I have/had with this is you often have to know what will be returned, and what type you need to save as. Usually this isn't difficult, but it adds an un-needed level of complexity.

The other major issues I have with this, is that it is quite verbose, and unnecessary. The code duplication here can be quite high.

Continue Reading

Xamarin For Android The Bad: (Part 2 of 4)

Xamarin is a very good platform, but like everything it has parts that are not so great.

Documentation

One thing that was really hard for me, was to find documentation that was newer than 2012. Android has made great strides with Ice Cream Sandwich, and Jelly Bean. New features such as fragments have breathed life into the platform.

The Xamarin documentation provides examples even with the newest features, but there is something about it that feels lacking. Almost like it was thrown together at the last minute. They have been doing webcasts to improve the knowledge out in the wild, but googling the answer to your problem just won't do. Part of the problem is that most developers write in Java, and only bigger companies can afford the hefty license fees that come with full support.

The user community was helpful at times, but I often found myself wandering though GitHub hoping my answer could be found in some mystical repo; Eventually having to study the full implementation to find the answer I needed.

Finding help

Although Xamarin has a forum where helpful users help each other, there are not nearly as many people coding on Xamarin than regular Java. Figuring out how to get something complicated working, was a nightmare. I'd look at a Java implementation, and then try to translate it into its Xamarin counterpart, which sometimes was far removed than the Java code. There are some examples of Xamarin for android out there, but nothing that really delves deep into manipulating the inner workings of the phone. I saw this especially when trying to edit contacts programatically. Xamarin support seemed helpful, but far too expensive for most freelance developers. This was a pretty huge put-off. If I went the Java route my questions would be answered with a simple search of stack overflow.

Boilerplate

Like most things Java, Android requires a lot of boilerplate. For a developer like myself, whom avoids Java this was a problem. I would have thought that Xamarin would have abstracted out more of the boilerplate than they did. On the one had, having my code look somewhat familiar when I see Java examples was nice, but on the other hand because the API is still different often the Java versions would not be close enough to fully help. My main problem with this, is if I really wanted to write boilerplate I would have used the Java libraries myself. They did make a start for this by generating the manifest file automatically, but I feel it needs to go further to fully mature this platform as a viable alternative to Java.

Continue Reading