Skip to content

Instantly share code, notes, and snippets.

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 — forked from yang-wei/README.md
SOLID Principles of Object Oriented and Agile Design
View README.md
View gpu_api.fut
-- 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 Feb 1, 2020 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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 Sep 10, 2018
medium.com print bookmarklet
View bookmarklet.js
(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);
})();
View .bash_profile
# -------------------------------
# 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
View js-general-cheatsheet
// 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}`);
}
View webstorm 64bit jre vmoptions
-server
-Xms1024m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=2048m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
View jq-cheatsheet.js
//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();
View 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 Nov 20, 2015
ecma script 6 cheat cheet
View es6-cheatsheet.js
/* 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,