Skip to content

Instantly share code, notes, and snippets.

function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
function move_next(a, obj) {
{
if (!Object.keys) {
Object.keys = function (obj) {
var keys = [];
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
keys.push(i);
}
}
@vmlinz
vmlinz / generate_docker_cert.sh
Created October 11, 2019 13:54 — forked from bradrydzewski/generate_docker_cert.sh
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@vmlinz
vmlinz / bot-detector.js
Created July 12, 2019 09:25
Bot detector js
function cmn(q, a, b, x, s, t) {
a = add32(add32(a, q), add32(x, t));
return add32((a << s) | (a >>> (32 - s)), b);
}
function fff(a, b, c, d, x, s, t) {
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function ggg(a, b, c, d, x, s, t) {
@vmlinz
vmlinz / Enhance.js
Created August 23, 2016 07:04 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
// @flow
import React from 'react';
const defaultFlags = {
// If logType is set to keys then the props of the object being logged
// will be written out instead of the whole object. Remove logType or
// set it to anything except keys to have the full object logged.
logType: 'keys',
// A list of the param "types" to be logged.
// The example below has all the types.

Keybase proof

I hereby claim:

  • I am vmlinz on github.
  • I am vmlinz (https://keybase.io/vmlinz) on keybase.
  • I have a public key whose fingerprint is 05A6 51B6 C1E8 98FA C5C7 A6C3 E22A E2B5 4C4E E919

To claim this, I am signing this object:

@vmlinz
vmlinz / nodejs-cluster-zero-downtime.md
Created July 28, 2016 04:48 — forked from jedi4ever/nodejs-cluster-zero-downtime.md
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

@vmlinz
vmlinz / setting-up-es6.md
Created June 29, 2016 04:42
Book on how to setup es6
@vmlinz
vmlinz / npm-cheat-sheet.md
Created June 27, 2016 14:51 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/: