Skip to content

Instantly share code, notes, and snippets.

View DmitryCape's full-sized avatar

Dmitry Sobolevsky DmitryCape

  • Cape Analytics
  • Munich
View GitHub Profile
@springmeyer
springmeyer / degress2meters.js
Last active July 3, 2024 12:18
convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)
// See https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames for more details.
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
x= -77.035974
@tpae
tpae / minHeap.js
Last active April 8, 2024 14:14
JavaScript implementation of Min Heap Data Structure
// Implement a min heap:
// -> insert, extract_min
// property:
// - elements are in ascending order
// - complete binary tree (node is smaller than it’s children)
// - root is the most minimum
// - insert takes O(logn) time
// - insert to the bottom right
@treyhuffine
treyhuffine / PromiseSimple.js
Last active November 2, 2022 13:21
A simple JavaScript Promise implementation for education purposes
class PromiseSimple {
constructor(executionFunction) {
this.promiseChain = [];
this.handleError = () => {};
this.onResolve = this.onResolve.bind(this);
this.onReject = this.onReject.bind(this);
executionFunction(this.onResolve, this.onReject);
}
@gourab5139014
gourab5139014 / create_hr_schema.sql
Created July 3, 2018 16:45
Script to create Oracle XE's HR schema in Postgres
-- Best used for learning purposes. Original developer also has an ER diagram available at https://dbseminar.r61.net/node/32
--create tables
BEGIN;
CREATE TABLE regions
( region_id SERIAL primary key,
region_name VARCHAR(25)
);
CREATE TABLE countries
@rogeriochaves
rogeriochaves / main.py
Created July 10, 2023 05:34
MULTI_PROMPT_ROUTER_TEMPLATE improved
"""You help triaging user requests. Given a raw text input, output either DOCS or DEFAULT, according to those definitions:
DOCS: if user is asking a seemingly technical question, programming questions or company-specific questions
DEFAULT: if user is just chit-chatting or basic knowledge questions
====================
Input: hello there
Output: DEFAULT