Skip to content

Instantly share code, notes, and snippets.

Avatar

martin krause martinkr

View GitHub Profile
@martinkr
martinkr / index.html
Created Nov 1, 2021
1 line of code: How to split an Array in half (http://jsbench.github.io/#44d4426b04ed29253d64e5ab813cfa28) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>1 line of code: How to split an Array in half</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@martinkr
martinkr / index.html
Last active Nov 1, 2021
1 line of code:Array/indexOfLowestNumber #jsbench #jsperf (http://jsbench.github.io/#ac1df98815e154b99f1bbca18c089170) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>1 line of code:Array/indexOfLowestNumber #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@martinkr
martinkr / index.html
Created Oct 24, 2021
1 line of code: How to count all occurrences in an Array (http://jsbench.github.io/#fd9adc367fcdc018994702e8becb038f) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>1 line of code: How to count all occurrences in an Array</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@martinkr
martinkr / react-lifecycle-block-done.js
Created May 27, 2019
The modified Gutenberg-Block from create-guten-block as react component.
View react-lifecycle-block-done.js
/**
* BLOCK: react-lifecycle-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@martinkr
martinkr / react-lifecycle-block-start.js
Last active May 27, 2019
The original Gutenberg-Block from create-guten-block before the modifications.
View react-lifecycle-block-start.js
/**
* BLOCK: react-lifecycle-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@martinkr
martinkr / Vagrantfile
Last active Dec 1, 2015
Vagrant: typical front end setup with ngnix / git / node / npm / gulp / bower / phantomjs / karma
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# "./Vagrantfile"
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
# set ports: according to your ngnix configuration
config.vm.network :forwarded_port, guest: 8080, host: 8080
@martinkr
martinkr / Vagrantfile
Created Nov 30, 2015
Vagrant: a simple setup with ngnix and php
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# "./Vagrantfile"
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
# set ports: according to your ngnix configuration
config.vm.network :forwarded_port, guest: 8080, host: 8080
View stylesheet-injector.js
(function() {
var css = [
'/css/default.css',
'/css/section.css',
'/css/custom.css'
],
i = 0,
link = document.createElement('link'),
head = document.getElementsByTagName('head')[0],
tmp;