Skip to content

Instantly share code, notes, and snippets.

{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-122.4233, 37.7768]
},
"properties": {
"name": "Main St & 1st Ave"
}
}
import heapq
def dijkstra(graph, start):
queue = [(0, start)]
distances = {vertex: float('infinity') for vertex in graph}
distances[start] = 0
while queue:
current_distance, current_vertex = heapq.heappop(queue)
for neighbor, weight in graph[current_vertex].items():
stop_id,stop_name,stop_lat,stop_lon
1,Main St & 1st Ave,37.7768,-122.4233
fetch('https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-34.397,150.644&radius=1500&type=restaurant&key=YOUR_API_KEY')
.then(response => response.json())
.then(data => {
data.results.forEach(place => {
this.addMarker({
lat: place.geometry.location.lat,
lng: place.geometry.location.lng
});
});
});
function display_google_map() {
ob_start();
?>
<div id="map" class="w-full h-96" x-data="googleMap()" x-init="initMap()"></div>
<script>
function googleMap() {
return {
map: null,
markers: [],
function enqueue_google_maps_api() {
wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places', [], null, true);
}
add_action('wp_enqueue_scripts', 'enqueue_google_maps_api');
function enqueue_alpine_js() {
wp_enqueue_script('alpine-js', 'https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js', [], null, true);
}
add_action('wp_enqueue_scripts', 'enqueue_alpine_js');
<div class="bynder-assets">
<?php foreach ($assets as $asset): ?>
<div class="asset-item">
<img src="<?php echo esc_url($asset['thumbnails']['url']); ?>" alt="<?php echo esc_attr($asset['name']); ?>">
<h3><?php echo esc_html($asset['name']); ?></h3>
<a href="<?php echo esc_url($asset['originalUrl']); ?>" download>Download</a>
</div>
<?php endforeach; ?>
</div>
<?php
/* Template Name: Brand Portal */
get_header();
function fetch_bynder_assets() {
$client_id = 'your_client_id';
$client_secret = 'your_client_secret';
$token = 'your_token';
$bynder_domain = 'https://yourcompany.bynder.com';
{
"Comment": "A complex example of a Step Function that processes data, checks quality, and logs results",
"StartAt": "ProcessData",
"States": {
"ProcessData": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:ProcessData",
"Next": "CheckQuality",
"Catch": [
{