Skip to content

Instantly share code, notes, and snippets.

@plugn
plugn / el-table-dyn.css
Last active February 17, 2020 18:05
element-ui table with dynamic columns layout
@import url("//unpkg.com/element-ui@2.4.11/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) {
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
MM_preloadImages('img1.gif','img2.gif'); //add more if required
@plugn
plugn / index.md
Created January 28, 2020 06:07 — forked from ericandrewlewis/index.md
C++ Pointer Tutorial

C++ Pointer Tutorial

Because pointers can be ugh

"Regular" variables (not pointers)

To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".

When declaring a variable by identifier (or name), the variable is synonymous with its value.

qsa = (q, c) => Array.from((c || document).querySelectorAll(q))
qs = (q, c) => (c || document).querySelector(q)
swgr = {
injected: false,
rules: `
.opblock .checked:after {
content: '✓';
font-size: 24px;
var leet = {
/**
* Map of conversions.
*
* @var object
*/
characterMap: {
'a': '4',
'b': '8',
@plugn
plugn / copyMR.js
Last active January 17, 2020 09:41
function copyMRDev() {
const confirmMR = () => {
const txt = document.querySelector('.mr-source-target .normal > strong').textContent.replace(/[\s]+/g, ' ').trim()
const url = location.href.replace(/\/diffs\/?/, '')
const msg = txt.replace('Request to merge ', 'MR\n').replace('into', '->')
return [msg, url].join('\n')
}
const writeToClipboard = (txt) => {
const range = (min, max) => Array.from(Array(max - min + 1).keys()).map(v => v + min)
const fizzBuzz = (max, min = 1) =>
range(min, max)
.reduce((acc, num) =>
[...acc, ((num % 3 ? '' : 'Fizz') + (num % 5 ? '' : 'Buzz') || num)],
[])
.join(', ')
// fizzBuzz(18)