So you've come to a point where you want to build nice CLIs. There's a few different options for building CLI's. My two favorites are oclif and commander.js. I tend toward leaning to commander, unless I know I'm building a super big app. However, I've really enjoyed building smaller CLIs with commander recently.
Dynamically changing the site-theme meta tag
So, incase you are unfamiliar, there is a meta tag called <meta name="theme-color" content="...">
that is used to change the color of the navbar on desktop safari, mobile safari, and mobile chrome. If you don't set a value these browsers tend to find a color that match the site to the best of their ability. However, sometimes even setting the value can cause the site to look ugly.
Hosting Craft CMS on Heroku
So, like most early startups, Quala (where I currently work) bought into a Wordpress site to sell our product, probably before it really existed. Flash forward, we have customers, and we're on a path to building a platform to change the game on customer management. The Wordpress site was terrible for performance, and core web vitals. None of us know Wordpress, and barely know any php. We had huge drive to rebrand ourselves, but to do that we needed to edit the Wordpress theme 😬 or use something else.
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.
5 web perf tips for 2019
As more and more of the world is getting online, a larger part of the internet community is using the internet on lower powered devices. Making websites fast is becoming paramount. Here are 5 tips to improving you web page's performance
Must have vscode plugins for front-end devs
I've had a lot of people ask me about my choice of editors, and plugins. A while back I switched to vscode for all my programming work, for both front and back end. In the past I've blogged about the best plugins for visual studio as a backend dev, but I thought I'd give you a more front-end angle
Compressing images with tinypng's CLI
Ok so I'm really lazy, and I honestly think that has helped me a lot in this industry. I always try to work smarter, not harder. I take many screen shots for this blog, and I need to optimize them. Incase you didn't know many images are often larger than they need to be slowing the download time. However, I don't ever want to load them into photoshop. Too much time and effort!
Rebuilding this blog for performance
So many people know me as a very performance focused engineer, and as someone that cares about perf I've always been a bit embarrassed about this blog. In actual fact this blog as it sits now is fast by most people's standards. I got a new job in July, and well I work with an absolute mad lad that is making me feel pretty embarrassed with his 900ms page load times. So I've decided to build my own blog engine, and compete against him.
Measuring, Visualizing and Debugging your React Redux Reselect performance bottlenecks
In the battle of performance one tool constantly rains supreme, the all powerful profiler! In javascript land chrome has a pretty awesome profiler, but every-time I looked into our react perf issues I was always hit by a slow function called anonymous function
Deploying a react app to azure blob storage websites with azure devops
Back in August of this year Microsoft announced static websites for azure blob storage. So this is the same feature AWS' S3 has had for years. Essentially make a blob storage folder public, and redirect /
paths to /index.html
internally. Also, register 404 pages. Before we had this we use to deploy our files to App Service
or do some weirdness with functions to rewrite urls. For static pages this can really bring costs down in the cloud
Creating a slack slash command with 0 code using Azure Logic Apps
Ok so recently I was chatting on a slack, mostly sharing cat pictures, when I realized the CarGurus slack account did not have a /cat
command. I knew immediately, this had to change!
Writing an animated flyout hamburger menu
So I'm currently sitting on a plane at the moment. A recent project I started on was a travel guide where I live. Being on a plane without wifi for a long time is a quick wakeup to me how much I rely on the internet to code.
Building dotnet core apps, and packages with gulp
Here we are, its 2017 dotnet core is out, and finally dotnet has a proper cli. In a previous post we explored the new cli. In short you can use the dotnet cli to build, test, package, and publish projects. However sometimes just using the cli is not enough. Sometimes, you land in a place where you have many projects to compile, test, and package.
Precompiling razor views in dotnet core
Recently I had heard live.asp.net had started to precompile the razor views. I figured I'd dig in and quickly figure out how to do it.
Exploring the dotnet cli
Now that dotnet core tools have been released I thought it would be good to look into the dotnet cli. This is a new command line interface to build, manage, compile and run dotnet core
based applications
VS 2017, and dotnet core tools. Today will be a historic day
Today marks the release of Visual Studio 2017, and with it the final release of the tools for dotnet core. This means as of today you can build, test, and deploy an application completely supported by microsoft. Not just the runtimes, but the tooling as well. The CLI for dotnet core has been finalized, and its awesome. The csproj system has been revitalized. New csproj's can be created, and are fully compatible with the old. Visual studio 2017 has finally released. This is probably the greatest version of visual studio ever created. Finally VS has gone from a slow, archaic editor, to a fast moving IDE. An IDE with a DevOps-First Cloud-First mentality. An IDE ready to tackle today's modern challenges.
StatsN a modern statsd client for dotnet core, and dotnet 4.5
tl;dr click here
When we talk about capturing metrics in applications. One server/service that constantly is in all conversations monitoring, is statsd. Incase you have never heard of it, statsd is a udp/tcp server that you send your in-code metrics to. These metrics get aggregated by statsd, and are forwarded to various backends. Some backends are services like librato or sumologic. Other times you are sending metrics to time series databases such as graphite or god forbid influxdb.
This boils down to in code you can say "log whenever this block of code is hit" or say "measure how long this function takes to execute". These stories come together to form pretty graphs, and rich alerts. All of this enabled by statsd.
Parsing cli arguments in dotnet core Console App
tl;dr view this gist
So its 2016, and we are still making console apps/cli's. In fact I would say there has been a surge in popularity of these types of tools. I think we have come to the realization that buttons on forms are not automatable, and that the command line doesn't have to be scary.
I recently started writing an app in dotnet core, which is the new runtime for dotnet. In the past I have often used command line parser, but as of this writing it does not support core.
I was really lost trying to find an arguments parsing library when I realized the dotnet cli was open sourced.
After much struggle, failing to bingle. I started ripping through the Entity Framework, and dotnet cli's code hoping to find a gem. Thats when I stumbled across a diamond. You see many dotnet projects use Microsft.Extension.CommandLineUtils to do cli parsing.
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.
Use dotnet rc2 with appveyor
dotnet CLI is currently in RC2, and while the train is fast approaching RTM, most tools are still catching up. dotnet seems to have a documented cli based install for every platform except the good ol windows. That being said getting a windows based install/build is possible.
Bringin' turbolinks to .net
For a while now I have been playing with rails, and rack webapps. If you are not familiar with these, they are webservers created in ruby. One of the features I ran into during my journey into ruby land is Turbolinks. Incase you are not familiar, Turbolinks is basically a simplified pjax, with a lot of flexibility. When you click on a link in a page with turbolinks, the link action is hijacked and the target page is loaded via ajax. The result of the ajax call (which is presumed to be html) will replace the document of the body tag. At the end of the day its a technology to load your server side pages via ajax.
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.
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 /rss
instead 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.
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.
Why I moved from Ghost to Hexo
Blogging right? I can't believe I somehow stuck with it all this time. Even when I took a long break I still kinda blogged. I got started after being ~~convinced~~ inspired by a coworkers passion to start blogging. To say the least he, and I have very similar tastes, and he turned me on to ghost, and the ghostium theme. After a year and a half of Ghost blogging I have left Ghost.
How the ASP.NET team made the web framework I have always wanted
So I know I do a lot of blogging about C#, or JavaScript, but I actually do a lot of nodejs apps as well as other languages. For a very long time I have not found the stack of my dreams. .NET has always been very close but there were multiple things about the app model that I was not a fan of. I think NancyFX has been the closest framework to my dreams in .NET land.
Securing AWS Elasticsearch Service with .NET NEST API (and why I love open source)
Around 6 months ago I started a project, and part of that project was to move us away from an old search tool to use elasticsearch.
Wiring up client side logs into c#/node.js logging frameworks
Around a year ago I joined a new team where I work, and this team was starting to undertake a full rewrite of their code. We were going from a full c#/mvc app to a tiny c# api, and a very big SPA.
Early one one of the huge things to do was to make sure that our JavaScript error logs could land in our Log4Net infrastructure. I started to write something to do just that, and as I was coding I quickly realized this was less trivial that it sounded. We had something internal we could use, but it was tied to a lot of other code that we didn't want to pull in.
I started Bingling around and I stumbled across jsnlog. JSN log lets you quickly wire up your client side logs to your server. I have been able to get PR's into the code base and the guy behind it has been very friendly to me when I have had questions.
Less Pager duty, more Yak duty. My (Strange) DevOps (rant) story.
Growing up I always wanted to work with electronics, and as soon as I could work I was working with a computer. I currently work as a Software Engineer at Vistaprint. I work on the Gallery team, which is an agile development team that works on our platform to display products in a gallery (hence the name). Before I joined the gallery team, I spent most of my career doing ops things.
Navigating the JavaScript waters in 2015
In this last year I have done much more JavaScript development than I have before. The landscape, and tools have exploded over the last few years. Gone are the days of JQuery widgets, and come forth have advanced virtual dom libraries, JavaScript servers, and multiple package managers. Along with new language features.
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.
VS 2015, Getting Resharper Experience Without Resharper
click here for vs2017
Resharper has long dominated the c# landscape as the tool of tools. Roslyn shipping with VS 2015, the quick actions light bulb, and the community analyzers, all combine to produce a resharper-like experience.
Using Bower with a traditional MVC.NET app (While thinking about vNext).
Where I work .NET rules supreme. Personally I really don't care that much about the technology so long as it supports really good workflows. One of my major issues with nuget is that is very opinionated.
Working with Entity framework (Code First)
Entity Framework is the ORM that has been pushed by the MSFT giant over the last few years to the .NET community.
Must Have Tool: NDepend
Code quality tooling has become a bigger, and bigger industry. Tools like Resharper, and stylecop have been telling us how bad us human beings are at developing code.
The one problem I have always had with these tools is they dont go above and beyond to help you understand your code at a higher level.
ChromeOS: Gateway to portable productivity
Up until the last few years the only devices on the market were all full operating system work horses. However the majority of us would easily sacrifice functionality for portability. This statement has been backed up by the increase of market demand for tablets and ultrabooks over the years.
Must have tool: LinqPad
LinqPad is an interactive C#/F#/VB.NET scratchpad that lets you run arbitrary C#/F#/VB.NET code, and also lets you query databases with linq.
Capturing Client Side JavaScript Errors
Capturing client side errors in my opinion is really good. For starters you can troubleshoot your client side implementation, but you can also make sure a js change did not break certain pages.
Below is a really simple, yet effective way to capture errors. Eventually you may want to implement something more advanced, but this will get you out of the gate.
Admob with Xamarin Android Part 1: BannerAd
This will be a brief overview on how to get admob working with Xamarin.
Disclaimer
I highly suggest you run this on a real phone. I'm not sure if the virtual phones can load content on the internet. I always develop on a real phone.
Sample code located in a repo at github
iPhone or Android (From a guy living with both)
I know, I know the very first question you ask is going to be why do you have two phones, the answer being One is for work, the other is for my personal life. Now that we are done with that subject, we can get on with the review...
Xamarin For Android The Good: (Part 1 of 4)
Introduction
- Part One
- Part Two
- Part Three
- Part Four
This will be a series of blog entries where I discuss the Xamarin platform for Android.
I really enjoy C# programming language (JavaScript second)....Linq, Generics, anonymous methods, and Visual Studio are just some of the reasons I like it. Xamarin is a platform that gives you the ability you to write Android applications in c#.
When I heard about Xamarin I naturally, wanted to give it a shot. Having tried Eclipse, and Android Studio for android development I was no idiot when it came to the platform. So I got a license, and did nothing with it for six months, until a few weeks ago. After only 3 days I created Ultimate Gravatar Sync. An app that sync's your contacts gravatar images to their picture in your phone.
C# with no compromise
The Xamarin platform uses mono, and some kind of voodoo bindings to the Java libraries to make it work. I wont go in depth, but the native features of the C# language are there to use. I never felt like my hands had been tied, that all of a sudden I couldn't use a library that is normally part of the GAC (Global Assembly Cache). When I needed multi-threading, System.Threading was there, and when I needed to use C# Generics I had no issues implementing them.
Manage Android Manifest files
One of the things that blew me away about the platform, was that I never had to add anything to my manifest file. For those of you whom don't know, Android requires an XML config detailing the permissions you require, and the classes you have in your application.
Simple decoration such as:
[Activity(Label = "Label", MainLauncher = true, Icon = "@drawable/Icon")]
Will Generate in your manifest file as:
<pre>
<activity
android:label="Label"
android:name=".logoActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</pre>
Adding permissions is also easy:
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
Using Java Libraries
Xamarin provides some kind of crazy visual studio project, that will essentially provide c# bindings to Java libraries you require. To bind Simply create a Java Binding project, adding the .Jar files, and then build. Watch the magic happen. They do note that you sometimes need to do some configuration for certain libraries, however I had no issues with the one I tried. On top of that if you really needed to, you could access the Java Native Interface for even more power.