Skip to content

Instantly share code, notes, and snippets.

@fly2279
fly2279 / gist:4edee4cb14e35c133806
Last active September 19, 2015 12:48
Query with belongsToMany and belongsTo association
$query = $this->Articles->find('all')
->matching('ArticlesAuthors', function ($q) {
return $q->where(['ArticlesAuthors.author_id' => 1]);
})
->where('Articles_author_id' => 1);
@fly2279
fly2279 / RadiusMode.js
Created July 5, 2024 15:53 — forked from chriswhong/RadiusMode.js
RadiusMode, a custom mode for mapbox-gl-draw for drawing a radius
// custom mapbopx-gl-draw mode that modifies draw_line_string
// shows a center point, radius line, and circle polygon while drawing
// forces draw.create on creation of second vertex
import MapboxDraw from 'mapbox-gl-draw';
import numeral from 'numeral';
import lineDistance from 'npm:@turf/line-distance';
const RadiusMode = MapboxDraw.modes.draw_line_string;