#EmberJS2019 More Accessible Than Ever


This post is by Yehuda Katz from Katz Got Your Tongue


Click here to view on the original site: Original Post




It’s that time of year again: time to think about what the next year of Ember should hold.

Personally, I feel really great about the community’s effort around the Octane edition. What’s great about Octane, and any future edition we do, is that it’s a focus on polishing and documenting the features, and providing a clear transitional path from where we were to where we’re going.

Octane includes a lot of stuff we’ve been working on for a long time. Some highlights:

  • jQuery is no longer included by default in new apps
  • Glimmer components are the default components in Octane, which includes a new, massively slimmed down base class and angle bracket invocation.
  • Element modifiers are a new, more composable way to interact with the DOM from components.
  • Tracked Properties are the default way of managing data flow in Octane, which eliminates the need for a special computed property feature.

    Continue reading “#EmberJS2019 More Accessible Than Ever”

Fun With PowerShell: Let’s Get Started (Digging Deeper into “The Pipeline”)


This post is by Yehuda Katz from Katz Got Your Tongue


Click here to view on the original site: Original Post




In the first post in the Fun with PowerShell series, we wrote a little script that searched the Open Movie Database for movies containing the word “Avengers”.

We learned about Invoke-RestMethod, the syntax for invoking commands, the concept of “pipelines”, and the fact that anything we type in a script that isn’t assigned to a variable or passed into a pipeline is printed out. We also learned about redirection and the special $null variable, which allows us to redirect output into nothingness.

If you’re just interesting in learning enough PowerShell to be useful, feel free to move on to the second post in the series (Fun With PowerShell: Deduplicating Records). But if you’re curious to dig deeper, let’s unpack a few of the concepts that we learned in more detail.

Invocation Syntax

Like in other shells, you invoke a command in Powershell by mentioning it.

Get-Process
  Continue reading "Fun With PowerShell: Let’s Get Started (Digging Deeper into “The Pipeline”)"

Fun with PowerShell, Deduplicating Records


This post is by Yehuda Katz from Katz Got Your Tongue


Click here to view on the original site: Original Post




In the previous post, we got a list of Avengers movies from the Open Movie Database and printed it onto the screen.

$movies = Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&s=Avengers"

$movies.search | Format-List
Title  : The Avengers
Year   : 2012
imdbID : tt0848228
Type   : movie
Poster : https://m.media-amazon.com/images/M/MV5BNDYxNjQyMjAtNTdiOS00NGYwLWFmNTAtNThmYjU5ZGI2YTI1XkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg

Title  : Avengers: Age of Ultron
Year   : 2015
imdbID : tt2395427
Type   : movie
Poster : https://m.media-amazon.com/images/M/MV5BMTM4OGJmNWMtOTM4Ni00NTE3LTg3MDItZmQxYjc4N2JhNmUxXkEyXkFqcGdeQXVyNTgzMDMzMTg@._V1_SX300.jpg

Title  : Avengers: Infinity War
Year   : 2018
imdbID : tt4154756
Type   : movie
Poster : https://m.media-amazon.com/images/M/MV5BMjMxNjY2MDU1OV5BMl5BanBnXkFtZTgwNzY1MTUwNTM@._V1_SX300.jpg

Title  : The Avengers
Year   : 1998
imdbID : tt0118661
Type   : movie
Poster : https://m.media-amazon.com/images/M/MV5BYWE1NTdjOWQtYTQ2Ny00Nzc5LWExYzMtNmRlOThmOTE2N2I4XkEyXkFqcGdeQXVyNjUwNzk3NDc@._V1_SX300.jpg

Title  : The Avengers: Earth's Mightiest Heroes
Year   : 2010–2012
imdbID : tt1626038
Type   : series
Poster : https://m.media-amazon.com/images/M/MV5BYzA4ZjVhYzctZmI0NC00ZmIxLWFmYTgtOGIxMDYxODhmMGQ2XkEyXkFqcGdeQXVyNjExODE1MDc@._V1_SX300.jpg

Title  : Ultimate Avengers
Year   : 2006
imdbID : tt0491703
 Continue reading "Fun with PowerShell, Deduplicating Records"

PowerShell, Let’s Get Started!


This post is by Yehuda Katz from Katz Got Your Tongue


Click here to view on the original site: Original Post




PowerShell, Let's Get Started!

I’ve been having a lot of fun playing around with PowerShell recently, and wanted to write up some of my learnings.

If you’re thinking: “I don’t use Windows, so this post isn’t for me”, good news! Microsoft has released versions of PowerShell for OSX and Linux with easy installers, and I’ve tested the examples in this series on both Windows and Linux. I document the installation instructions in a separate post.

Let’s get started. We’ll interact with a REST API called the Open Movie Database. All of the APIs in OMDB require a (free) API key, so if you want to follow along, start by grabbing one.

Let’s create a new directory called powershell-explore and create a new file in that directory called omdb.ps1. The ps stands for “PowerShell” and the 1 stands for “maybe we’ll want a version 2 someday” (also .ps is taken by PostScript).

$key =  Continue reading "PowerShell, Let’s Get Started!"

PowerShell, Installation


This post is by Yehuda Katz from Katz Got Your Tongue


Click here to view on the original site: Original Post




In my post on exploring PowerShell, I jumped right in to exploring PowerShell.

If you’re on Windows, you already have PowerShell, and you can follow along.

If you’re on OSX, the easiest way to install PowerShell is

$ brew cask install powershell
$ pwsh

There are more details at Installing PowerShell Core on macOS (docs.microsoft.com).

On Ubuntu, it’s

$ sudo apt-get install -y powershell

There are more details, and instructions for other distributions at Installing PowerShell Core on Linux (docs.microsoft.com).

ActiveRecord to JSON API Part 6: Mimicking AR


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




As we worked through the conversion from ActiveRecord to JsonApiClient, we came across some methods implemented by ActiveRecord that would still be useful to have around.

Background

We were building an internal JSON API using the following libraries:

For more information on our goals and set up for the internal API, see part 1 of this series.

Pluck

One of the first things we noticed we were converting over and over again was ActiveRecord’s pluck method. With the JsonApiClient resources, we were converting all the ActiveRecord pluck calls to chaining select(:field).map(&:field).

Not only was this repetitive and time consuming to convert, but we felt like it was burdensome for future developers on the application to have to remember to do.

We decided to try to figure out how we could implement pluck on the Continue reading “ActiveRecord to JSON API Part 6: Mimicking AR”

Programming Machine Learning, in beta


This post is by from Pragmatic Bookshelf


Click here to view on the original site: Original Post




The nature of software and fixed bid contracts


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




Software is abstract. It is soft, where is it? I can not hold it in my hands or feel it's weight. Is it substantial, insubstantial? Are you impressed by the effort I put into it? Are you disappointed in my apparent slowness while making this software?

Before I write software for you, I am confident that it will be wholly unique. Never before will it have been written, or else why would you want it? If it's not unique, can you instead purchase it elsewhere? Even if it exists, you can't purchase it, and you'd like me to recreate it, I cannot duplicate someone else's software bit for bit. That's like trying to act Patrick Stewart's MacBeth in a way that's indistinguishable from Patrick Stewart. With my first breath I will have failed. I have not lived Patrick Stewart's life, my voice box and diaphragm are different dimensions, and my Continue reading “The nature of software and fixed bid contracts”

ActiveRecord to JSON API Part 5: Polymorphism


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




The Rails application we were working with had a number of polymorphic relationships that included the models we were moving to the JSON API, as well as a polymorphic relationship within the models being migrated.

This raised an interesting question for us. How do we maintain those relationships without changing the core functionality of the app and the models involved? And how will the polymorphic API associations function?

We wound up facing two issues with polymorphism during the conversion process.

  1. Making the ActiveRecord resources remaining in the application capable of being related to both other ActiveRecord resources, and to JsonApiClient resources
  2. Making JsonApiClient resources fetch polymorphic API associations when the associated data was not eager loaded from the API.

Background

We were building an internal JSON API using the following libraries:

For more information on Continue reading “ActiveRecord to JSON API Part 5: Polymorphism”

Modern Erlang for Beginners, now available


This post is by from Pragmatic Bookshelf


Click here to view on the original site: Original Post




Cast/Share your iPhone/iPad screen to Mac


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




If you are pairing remotely on a mobile web project or doing a presentation that includes a mobile demo it is often helpful to share your iOS screen on your Mac.

Recently, we have been working on a project that uses ApplePay on the web which proved difficult to test on a desktop computer, and we wanted to show how it worked on an iPhone.

There are quite a few software products that can help you achieve this goal, but many of them cost money or are unreliable. In this post I will share with you some solutions I have used successfully to share my mobile device's screen. I’m not going to cover all the solutions that exist out there, and ultimately there are no right or wrong answers – it is whatever works for your use case.

Reflector – Cost: $14.99

Reflector is a software solution by Air

Imgur
Imgur
Imgur
Imgur
Imgur
Imgur
Imgur

Continue reading “Cast/Share your iPhone/iPad screen to Mac”

ActiveRecord to JSON API Part 4: Custom Sorting


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




The JSONAPI::Resources automatically supported sorting on database fields, but didn’t handle custom sorting without requiring overrides to library methods.

Background

We were building an internal JSON API using the following libraries:

For more information on our goals and set up for the internal API, see part 1 of this series.

Custom Sorts

In a few of the ActiveRecord models we were converting, there were some custom sort methods that we needed to be able to specify through the API.

class LocalAPI::Foo < ApplicationRecord
  # …

  def self.abcs_last
    order("CASE foos.some_field WHEN 'abc' THEN 1 ELSE 0")
  end

  # … 
end

The JSONAPI::Resources automatically supported sorting on database fields, but in their documentation, they specify that any custom sorts require overriding the apply_sort method on the specific JSONAPI::Resource you’re working Continue reading “ActiveRecord to JSON API Part 4: Custom Sorting”

March PragPub Magazine now available


This post is by from Pragmatic Bookshelf


Click here to view on the original site: Original Post




Pick a Good Name


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




I've been fortunate to work on some long-running projects, and they always confirm the importance of choosing good names. In this post, I'd like to talk about my thoughts on what makes a name good.

There are only two hard things in Computer Science: cache invalidation and naming things.
— Phil Karlton

The importance of naming things seems abstract until you've done it badly a
lot. Imagine a function like this:

def a(b, c)
  d = b + c
  d
end

This is often called 'golf code' because it requires few keystrokes to
type, relative to something more verbose. It's impossible to maintain.
Only the person who wrote the function knows what a, b, c, or d
represent. Everybody else has to load the domain into their head every time
they see it.

Bad names make it difficult to search through the code. Continue reading “Pick a Good Name”

ActiveRecord to JSON API Part 3: Handling Filtering


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




Did you know that Puma has a 10,240 character query string limit? We do now.

In the process of building our internal JSON API, we found two issues with handling filtering:

  1. Query string limitations
  2. Querying for an array of IDs when some values were nil

Background

We were building an internal JSON API using the following libraries:

For more information on our goals and set up for the internal API, see part 1 of this series.

Query Strings

Given that the JsonApiClient filtering methods use an HTTP GET with query string parameters, character limits quickly became a concern for us. How could we ensure that some of our lengthier queries weren’t exceeding the limit and failing?

The simplest solution to us was to make the filters a POST request, even if that was a divergence Continue reading “ActiveRecord to JSON API Part 3: Handling Filtering”

The Ray Tracer Challenge, in print


This post is by from Pragmatic Bookshelf


Click here to view on the original site: Original Post




Write A Reduce Function From Scratch


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




JavaScript's Array object has a built-in reduce method. This is a handy,
yet underutilized method. Let's take a closer look at what reduce does and
see if we can implement it from scratch.

Reduce?

Here is what
MDN
has to say about reduce:

The reduce() method executes a reducer function (that you provide) on each
member of the array resulting in a single output value.

So, we can take an array of things and turn it into something else using a
function that we get to define.

const sum = list => list.reduce((total, val) => total + val, 0);

sum([1,2,3,4]) // => 10

The reduce method can seem pretty limiting at first when we read that it
produces "a single output value." That makes it sound like all it is good
for Continue reading “Write A Reduce Function From Scratch”

Books that Made me Happy 2018


This post is by from Blog - Noel Rappin Writes Here


Click here to view on the original site: Original Post




Books that made me happy 2018

Well, I failed in my plan to get this out by the end of January, but here are the books I liked in 2018. Unlike past years, here they all are in one post, I think it’s about 25. I tried, with mixed success to not write six gazillion words about each book.

Enjoy!

My favorite book of the year

The Calculating Stars / The Fated Sky by Mary Robinette Kowal— if you have ever liked anything I’ve recommended ever, there’s a good chance you’ll like this. After a meteor wipes out the Eastern seaboard in 1952, the space race becomes a race against climate change, and humanity goes to the moon, and then Mars. These are books with lots of smart people solving hard problems under pressure. It’s like The Martian but with fewer potatoes, and more punch cards and representation. It’s amazing.

Continue reading “Books that Made me Happy 2018”

ActiveRecord to JSON API Part 2: Solving Pagination


This post is by Hashrocket from Hashrocket


Click here to view on the original site: Original Post




While building an internal JSON API for a Rails application, we came across a few issues with pagination.

  • Making Kaminari work
  • Resolving problems with pagination link parameters
  • Enabling pagination while still allowing users to get everything

Background

We were building an internal JSON API using the following libraries:

For more information on our goals and set up for the internal API, see part 1 of this series.

Kaminari

The application we were working on was using Kaminari for pagination, and one of the first things we noticed during our switch from ActiveRecord to JsonApiClient::Resources was that pagination no longer worked, but only when the page number param was not present.

Upon investigating the source code for JsonApiClient, we noticed that when the page number param was blank during pagination, the page was resolved to 0, Continue reading “ActiveRecord to JSON API Part 2: Solving Pagination”

Docker for Rails Developers, in print


This post is by from Pragmatic Bookshelf


Click here to view on the original site: Original Post