Skip to content

Instantly share code, notes, and snippets.

View Stifutina's full-sized avatar

Nastya Naydenko Stifutina

  • 20:45 (UTC -12:00)
View GitHub Profile
@Stifutina
Stifutina / simpleajax
Created February 22, 2019 12:16 — forked from keyle/simpleajax
Simple ajax, pure javascript, no jquery
function callAjax(url, callback){
var xmlhttp;
// compatible with IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
callback(xmlhttp.responseText);
}
}
xmlhttp.open("GET", url, true);
@Stifutina
Stifutina / simple-pagination.js
Created June 7, 2018 15:07 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@Stifutina
Stifutina / cookies.js
Created December 16, 2016 18:02 — forked from CrocoDillon/cookies.js
Export your awesome module using AMD, CommonJS, Node.js or just as global.
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {