Skip to content

Instantly share code, notes, and snippets.

View eimfach's full-sized avatar
💭
https://www.robingruenke.com/journal/blogging/tools/how-my-journal-is-build.html

Robin Gruenke eimfach

💭
https://www.robingruenke.com/journal/blogging/tools/how-my-journal-is-build.html
View GitHub Profile
@eimfach
eimfach / README.md
Created May 25, 2021 14:19 — forked from yang-wei/README.md
SOLID Principles of Object Oriented and Agile Design
-- High level API which compiles to GPU code
-- It can also compile to a opencl python module (which we use: gpu.py)
-- Dependency: pyopencl
-- TOTALLY AWESOME STUFF INCOMING !!!
-- See: https://futhark-book.readthedocs.io/en/latest/interoperability.html#calling-futhark-from-python
-- Overview: https://futhark-lang.org
-- vector * vector
let dotprod (u: []f32) (v: []f32): f32 =
reduce (+) 0.0 (map2 (*) u v)
@eimfach
eimfach / what-forces-layout.md
Created February 1, 2020 00:15 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@eimfach
eimfach / bookmarklet.js
Created September 10, 2018 16:16
medium.com print bookmarklet
(function(){
var iframes = document.getElementsByTagName('iframe'); for(var i = 0; i < iframes.length; i++) {iframes[i].width = "auto"; }
var content="@media print { img {max-width: 640px !important;} iframe { width: auto; display: block; } .section-inner.sectionLayout--insetColumn { max-width: 1024px !important; padding: padding: 0px 0px !important; } }";
var style = document.createElement('style');
style.appendChild(document.createTextNode(content));
document.getElementsByTagName('head')[0].appendChild(style);
})();
# -------------------------------
# GIT CONFIGURATION
# -------------------------------
# checks if branch has something pending
parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
# gets the current git branch
// check integer array
const num = parseFloat(value);
// num is 0 if you parseFloat for example a hex value - we don't
// want that
if (num === 0 || num % 1 !== 0) {
throw new TypeError(
`Array value invalid, Integer > 0 expected, got: ${value}`);
}
-server
-Xms1024m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=2048m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
//filter textnodes wrap then in p and remove all br elements
$($element.contents()).filter(function(){
this.textContent = _.trim(this.textContent); // trim trailling and leading white spaces
return this.nodeType === 3; // filter textnodes only
}).wrap('<p></p>').end().filter('br').remove();
@eimfach
eimfach / protips.js
Last active August 29, 2015 14:24 — forked from nolanlawson/protips.js
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@eimfach
eimfach / es6-cheatsheet.js
Last active November 20, 2015 23:14
ecma script 6 cheat cheet
/* for of loops and iterables */
for(let char/*can use destructuring here*/ of "hello"){
console.log(char); // unicode char
}
for(let value of [1,2,3]){
console.log(value);
}
/*for of is for iterable objects like arrays and collections like Map or Set,