Skip to content

Instantly share code, notes, and snippets.

🐢
slowly but surely

Guseyn Ismayylov Guseyn

🐢
slowly but surely
View GitHub Profile
@jhurliman
jhurliman / base64.js
Created Sep 29, 2011 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
View base64.js
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@weepy
weepy / gist:6009631
Created Jul 16, 2013
Cubic Roots Solver Function in JS
View gist:6009631
function CubicSolve(a, b, c, d){
b /= a;
c /= a;
d /= a;
var discrim, q, r, dum1, s, t, term1, r13;
q = (3.0*c - (b*b))/9.0;
r = -(27.0*d) + b*(9.0*c - 2.0*(b*b));
@diolavr
diolavr / javascript.translit.js
Last active Jul 30, 2020
JavaScript translater russian to translit
View javascript.translit.js
function rus_to_latin ( str ) {
var ru = {
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',
'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh',
'щ': 'shch', 'ы': 'y', 'э': 'e', 'ю': 'u', 'я': 'ya'
}, n_str = [];
@Daniel-Hug
Daniel-Hug / unwrap.js
Last active Jun 16, 2019
JS: unwrap element (remove parent without removing child nodes). Demo: http://jsbin.com/hipahu/edit?html,js,output
View unwrap.js
// remove parent without removing childen
function unwrap(wrapper) {
// place childNodes in document fragment
var docFrag = document.createDocumentFragment();
while (wrapper.firstChild) {
var child = wrapper.removeChild(wrapper.firstChild);
docFrag.appendChild(child);
}
// replace wrapper with document fragment
@internetimagery
internetimagery / bounds.py
Created Dec 23, 2015
bezier bounding box
View bounds.py
# http://stackoverflow.com/questions/2587751/an-algorithm-to-find-bounding-box-of-closed-bezier-curves
from __future__ import division
import math
def getBoundsOfCurve(x0, y0, x1, y1, x2, y2, x3, y3):
tvalues = []
bounds = [[], []]
points = []
@jesgs
jesgs / deploying-from-github-to-vps-using-travis-ci.md
Last active Jul 1, 2020
Deploying from Github to VPS using Travis CI
View deploying-from-github-to-vps-using-travis-ci.md

From: https://www.jesgs.com/blog/2017/12/18/deploying-from-github-to-vps-using-travis-ci

Recently, I spent around 14 to 16 hours learning all of the necessary steps to getting an existing repo set up with Travis CI to run unit tests, and then once successful, connect to a remote server that isn't a PaaS (in this case, Linode) and then proceeds to use Git hooks to do post deployment things.

Starting with your local machine and you have your project already checked out from Github.

Setting Up

  • Assuming you have Ruby (at least 2.3.1) installed, run gem install travis. This installs the Travis CI command-line tools. We're going to use these tools to encrypt RSA keys that Travis will use to connect to your remote server.
  • This tutorial also assumes that you have a working repo and a Travis-CI account set up.
@kolosovsky
kolosovsky / aabb.md
Last active Apr 28, 2020
The computation of the axis-aligned bounding box (AABB) in JavaScript
View aabb.md

The computation of the axis-aligned bounding box (AABB) in JavaScript

Polygon (rectangle, triangle, etc.)

Live demo https://jsfiddle.net/Kolosovsky/tdqv6pk2/

let points = [
	{ x: 125, y: 50 },
	{ x: 250, y: 65 },
You can’t perform that action at this time.