This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function hashString(str) { | |
const data = new TextEncoder().encode(str); | |
const hashBuffer = await crypto.subtle.digest("SHA-256", data); | |
return Array.from(new Uint8Array(hashBuffer)).map(b => b.toString(16).padStart(2, '0')).join(''); | |
} | |
const hash1 = await hashString(string1); | |
const hash2 = await hashString(string2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// list resources | |
// read resource, "Hello World" | |
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; | |
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; | |
import { | |
ListResourcesRequestSchema, | |
ReadResourceRequestSchema, | |
} from "@modelcontextprotocol/sdk/types.js"; | |
// Initialize server with resource capabilities |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculatePolygonArea(coordinates) { | |
// Check if the polygon is closed (first and last points should match) | |
const first = coordinates[0]; | |
const last = coordinates[coordinates.length - 1]; | |
if (first[0] !== last[0] || first[1] !== last[1]) { | |
coordinates.push([...first]); // Close the polygon if not already closed | |
} | |
// Calculate average latitude for longitude scaling | |
const latitudes = coordinates.map(coord => coord[1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.draggable-console { | |
z-index: 4; | |
position: absolute; | |
background: #FFF; | |
border: 1px solid #ccc; | |
font-size: .75rem; | |
&.collapsed { | |
> :not(.title) /* .console */ { | |
display: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dialog-modal { | |
border: 0; | |
border-radius: 0.5rem; | |
width: 50%; | |
height: 75%; | |
padding: 0; | |
overflow: auto; | |
background-color: #f6f6f6; | |
&::backdrop { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import structuredClone from "@ungap/structured-clone"; | |
export const UndoRedo = { | |
debounceMs: 300, | |
timeout: 0, | |
undoStack: [], | |
redoStack: [], | |
reset(item) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! function(t, e) { | |
'object' == typeof exports && 'object' == typeof module ? module.exports = e() : 'function' == typeof define && define.amd ? define([], e) : 'object' == typeof exports ? exports["grapesjs-plugin-grid"] = e() : t["grapesjs-plugin-grid"] = e() | |
}('undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : this, (() => (() => { | |
"use strict"; | |
var t = { | |
d: (e, n) => { | |
for (var o in n) t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { | |
enumerable: !0, | |
get: n[o] | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"countries": [ | |
{ | |
"name": "Afghanistan", | |
"code": "AF" | |
}, | |
{ | |
"name": "Åland Islands", | |
"code": "AX" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yyyy - full uyear, e.g. 1969 | |
// mm - two digit month, e.g. 01, 12 | |
// mmm - e.g. Jan, Feb, Mar | |
// dd - two digit date e.g. 01, 31 | |
// ddd - 1st, 2nd 21st | |
// www - e.g. Mon, Tue, Wed... | |
function formatDate(date, format = 'yyyy-mm-dd') { // mm/dd/yyyy, www MMM DDD YYYY | |
const day = date.getDate(); | |
const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; | |
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; |
NewerOlder