Skip to content

Instantly share code, notes, and snippets.

View PolyDevil's full-sized avatar

‮((^_^ PolyDevil

View GitHub Profile
@jupdike
jupdike / IntersectTwoCircles.js
Last active May 29, 2025 13:36
Find the intersections (two points) of two circles, if they intersect at all
// based on the math here:
// http://math.stackexchange.com/a/1367732
// x1,y1 is the center of the first circle, with radius r1
// x2,y2 is the center of the second ricle, with radius r2
function intersectTwoCircles(x1,y1,r1, x2,y2,r2) {
var centerdx = x1 - x2;
var centerdy = y1 - y2;
var R = Math.sqrt(centerdx * centerdx + centerdy * centerdy);
if (!(Math.abs(r1 - r2) <= R && R <= r1 + r2)) { // no intersection
@gyandeeps
gyandeeps / repeat-promise.js
Created November 8, 2016 03:44
Keep calling a promise every n sec until resolved
let i = 0;
const test = () => new Promise((resolve, reject) => {
i++;
console.log(`Promise called - ${i}`);
if (i === 5) {
resolve();
}
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@cleure
cleure / min_max.c
Last active January 4, 2024 22:21
Branchless Min/Max
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <math.h>
int32_t min_int32(int32_t a, int32_t b)
{
uint32_t branch1,
branch2,
@rxaviers
rxaviers / gist:7360908
Last active November 3, 2025 16:44
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: