Skip to content

Instantly share code, notes, and snippets.

@plugn
plugn / objectUtils.js
Last active August 3, 2021 22:52
magical comprehensions for JS Object instances
/**
* @title objectUtils.js
* @description magical comprehensions for JS Object instances
* @author Max L Dolgov, [email protected]
*
* Here is `var` keyword for ability to re-declare functions,
* it makes tweaking functions in browser console possible.
*
*/
@plugn
plugn / php.func.es6js.js
Last active August 3, 2021 15:11
php.func.es6.js
/**
* php.es6
* @description PHP functions implemented in JavaScript/ES6
* @author Max L Dolgov <[email protected]>
*/
function count(value) { return value.length }
function chr(num) { return String.fromCharCode(num) }
function ord(str) { return String(str).charCodeAt(0) }
function trim(str) { return String(str).trim() }
function substr(str, start, length) { return String(str).substr(start, length) }
@plugn
plugn / flexbox.html
Created April 3, 2020 00:02 — forked from Munawwar/flexbox.html
HBox and VBox layout with CSS3 flexbox
<!DOCTYPE HTML>
<html>
<head>
<!-- HBox and VBox layouts have been implementated with many libraries/toolkits on
different platforms and languages (like ExtJS,QT,GTK,.NET...).
This tries to achieve the same but with CSS only.
Supported browsers: IE 10+, Safari 6.1, Latest FF, Chrome -->
<style type="text/css">
html, body {
// console.log `this`
{
console: {
log: function log()
},
scriptArgs: [],
print: function print(),
__loadScript: function __loadScript(),
os: {
O_APPEND: 8,
@plugn
plugn / fun.cpp
Created March 23, 2020 23:39 — forked from dant3/fun.cpp
Some fun with C++ 11 - fold, map, reduce, mkString for std::vector<T>
#include <iostream>
#include <sstream>
#include <functional>
#include <vector>
template <typename T, typename U>
U foldLeft(const std::vector<T>& data,
const U& initialValue,
const std::function<U(U,T)>& foldFn) {
typedef typename std::vector<T>::const_iterator Iterator;
@plugn
plugn / el-table-dyn.css
Last active February 17, 2020 18:05
element-ui table with dynamic columns layout
@import url("//unpkg.com/[email protected]/lib/theme-chalk/index.css");
@plugn
plugn / gcd.js
Last active February 11, 2020 23:49
greater common divisor
function gcd (a, b) {
if (a === b) {
return a
}
const major = a > b ? a : b
const minor = a > b ? b : a
for (let i = minor; i > 0; --i) {
if (major % i === 0 && minor % i === 0) {
@plugn
plugn / jenkins-api.md
Created February 4, 2020 10:03 — forked from justlaputa/jenkins-api.md
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

#include <iostream>
#include <vector>
#include <cmath>
std::vector<double > calc_sqrt_results(int a, int b, int c)
{
std::vector<double> results;
double discriminant = b * b - (4 * a * c);
if (discriminant == 0) {