This year, I really wanted to work on my output, and I think I’m doing pretty well. Here are some things that I’ve been publishing:
Regular monthly blog posts on yakushima.blog A few posts this year on the Geolonia blog for work However, updates on this personal blog has been not so great – the previous post is the “2023 review” post, after all.
I’ve been updating this blog from 2012, when we officially incorporated Flagship.
There’s a guide to writing browser acceptance tests for Phoenix. Acceptance tests are nice, but sometimes you want to have unit tests. This is very easy to do with your Elixir code, but what about your JavaScript code that lives inside your Phoenix application?
I couldn’t find a good guide on this, so I’ll go over what I have set up for one of my latest Phoenix projects.
Setup First, install mocha if you haven’t already.
In Ruby, there is a very handy class called StringIO. Basically, it allows you to treat a string like you would an IO object, such as an open file, etc. Very useful for in-memory “files” that you may not want to write to a temporary file.
In Elixir, there is a module called StringIO in the standard library. At first glance, these seem pretty similar:
Ruby:
Pseudo I/O on String object.
My favorite pizza is the pizza Margherita. Any pizzeria I go to, I will order the Margherita first.
Why? It’s brutally simple. Four ingredients: dough, tomato sauce, mozzarella cheese, basil.
I wish more websites and applications would be like a good Margherita.
Simple.
Delicious.
????
Edit Sept. 30 2016: PostgreSQL 9.6 was released today, and these instructions should work – just replace 9.4 with 9.5 and 9.5 with 9.6. I also have a guide using pg_upgradecluster on Ubuntu.
PostgreSQL 9.5 was released on Jan. 7, with lots of exciting new features.
I wrote a post about upgrading from 9.3 to 9.4 in the past, and many people found it useful, so I decided to update it a bit for the 9.
filter_zed_by = "1" list = [ %{"a" => "1", "b" => "2"}, %{"a" => "1", "b" => "5"}, %{"a" => "2", "b" => "5"}, %{"z" => "1", "x" => "2"} ] Enum.filter list, fn %{"z" => ^filter_zed_by} -> true _ -> false end # => [%{"z" => "1", "x" => "2"}] case in a fun is usually redundant if is even worse keep it simple
Note (2019/07/05): I’ve posted a follow-up to this post about limitations about the technique used here, especially when hosting an API on the same domain.
Amazon S3 is a great place to store static files. You might want to even serve a single-page application (SPA) written in JavaScript there.
When you’re writing a single-page app, there are a couple ways to handle URLs:
A) http://example.com/#!/path/of/resource B) http://example.com/path/of/resource A is easy to serve from S3.
So, this is a thing:
bundle install --without development:test ... ... Bundle complete! XX Gemfile dependencies, XX gems now installed. Gems in the groups development and test were not installed. Now,
bundle install ... ... Bundle complete! XX Gemfile dependencies, XX gems now installed. Gems in the groups development and test were not installed. Basically – you run bundle install --without <group> once, and that’s saved in .bundle/config. So next time you run bundle install without any arguments, it won’t install gems in the groups you specify.
Note: This blog post covers the legacy SSL Endpoint. Heroku now recommends the use of Heroku SSL, which can provide you with a free certificate and HTTPS (provided you are using the Hobby tier or higher).
If you use Heroku, you probably know a couple things:
You can’t use an apex domain for your site (unless you use a DNS service that emulates ALIAS / ANAME records). Using your own SSL certificate costs $20/month.
Edit 2016/4/29 I have written a follow-up piece to this blog post.
As many of you probably know, I am a professional programmer. I started my professional career with WordPress and PHP development, and now I find myself doing a lot of Ruby work. I am still in the very early stages of my professional career – I have only been doing this for about 5 years. There are people who are much more experienced than I am, and there is a whole world of things that I have yet to learn and experience.
It may be easy to use the same master Access Key and Secret Access Key for all your apps using Amazon AWS, but it’s definitely not secure and recommended against.
That said, I had a little trouble writing the IAM policy granting a single user access to a single S3 bucket. I finally had time to sit down and figure it out today, and turns out - it’s pretty easy. Up to this point, I’m assuming that you’ve already created your user, but if you haven’t - the IAM management console is located here: https://console.