Warning: The magic method SFML_Singleton::__wakeup() must have public visibility in /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php on line 72
Thoughts, etc. – Tracking the occasional random walk

Thoughts, etc.

Tracking the occasional random walk

JSON responses as PHP arrays in Laravel 8 tests

2021-02-10 / Leave a Comment

I’m in the process of upgrading an API code base that has been in production since Laravel 5, and continues to evolve. The bulk of the update to version 8 went smoothly, but one breaking change that I couldn’t find documented anywhere held me up for some time this afternoon. A great many of the … [Read more…]

Posted in: code Tagged: laravel

MMSI parsing library: mmsi.js

2020-02-11 / Leave a Comment

A Maritime Mobile Service Identity is a nine-digit number that can be broadcast by a ship or other vessel to provide some information about itself and its current location, to anyone within radio range. I recently published on NPM a small JavaScript library for validating MMSIs and parsing them to extract details about the country … [Read more…]

Posted in: open source Tagged: javascript, library\, mmsi, parser

Measuring distances on Leaflet maps in Vue applications

2019-04-25 / 2 Comments

Vue2Leaflet is a great library that provides a very straightforward approach to using Leaflet maps in Vue applications. Leaflet.PolylineMeasure is a great Leaflet plugin that adds a tool to allow the user to measure distances along (poly)lines by drawing them on top of the map. Today I released the initial version of a Vue2Leaflet plugin to … [Read more…]

Posted in: open source Tagged: leaflet, vue

Side effects of js-data-http and async operations

2018-06-15 / Leave a Comment

Recently I encountered a rather strange scenario, wherein I created two different  findAll operations using the js-data-http adapter for a js-data query, only to see two identical network requests emitted. The root of the problem turned out to be that I was creating a single object to hold the query options and reusing it across requests, in … [Read more…]

Posted in: code, front-end Tagged: js-data

Adding Vue reactivity to js-data relationships

2018-05-16 / 3 Comments

While attempting to have Vue components react to changes in my js-data model instances and their relationships, I found a great post from Caleb Roseland with an accompanying code example. They detail how to make model properties reactive in Vue, without overriding js-data’s own reactivity. What they don’t discuss is how to make Vue react … [Read more…]

Posted in: front-end Tagged: js-data, vue

Getting a Faker instance in Laravel’s tinker environment

2018-05-03 / 3 Comments

I sometimes find that it would be useful to use  artisan tinker to play with the sorts of data that Faker will generate in a Laravel factory. Unfortunately I don’t do it often enough to always remember the correct way to do it, since the obvious  new Faker\Generator doesn’t work. So for future reference, what you need is:

1
>>> $faker = Faker\Factory::create();

 

Posted in: snippets Tagged: laravel, notes

What to do if js-data serializes array elements as empty objects

2018-04-30 / Leave a Comment

TL;DR: Use the items validation keyword to specify the data type of the elements of arrays in your js-data schema to avoid unexpected results when serializing records, e.g. for saving. The setup I was using js-data v3 with a schema containing an array field recently, and came across some initially baffling behaviour. I had a fooSchema … [Read more…]

Posted in: code Tagged: js-data

Ember pagination links

2018-01-16 / Leave a Comment

An Ember project I’m working on needed a simple set of links to move through a paginated JSON API. There are a few pagination-related addons out there, but they tend to want to deal with your data and model collections, as well as the display of pagination links. I was looking for something that would … [Read more…]

Posted in: open source Tagged: ember, ember-addon, ember-pagination-links

Clearing an Ember Paper select component

2017-09-01 / Leave a Comment

To allow users to clear the selection of an Ember Paper {{paper-select}} component, simply pass it the  allowClear=true option:

Allowing a paper-select component to be cleared
1
2
3
4
5
6
{{#paper-select
    placeholder="Select a thing..."
    required=false
    allowClear=true
    ...
}}

This option is passed along to the ember-power-select component that ember-paper uses under the hood, so the resulting clear button can be styled accordingly. For example,

Styling the clear-selection button
Sass
1
2
3
4
.ember-power-select-clear-btn {
  position: absolute;
  right: 25px;
}

Thanks to @miguelcobain for this tip on the community Slack channel.

Posted in: front-end Tagged: ember, ember-paper

Primary keys other than “id” in lumen-jwt

2017-06-20 / Leave a Comment

Lumen-jwt is a great library that easily adds JavaScript Web Token (JWT) authentication to any Lumen application. I recently had the opportunity to submit my second pull request to the project, allowing user accounts to be uniquely identified via fields other than id, which was previously the only option. (As of this writing the PR has been … [Read more…]

Posted in: code Tagged: jwt, lumen, php
1 2 3 Next »