start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/bash | |
if [ ! -r "/usr/local/git" ]; then | |
echo "Git doesn't appear to be installed via this installer. Aborting" | |
exit 1 | |
fi | |
echo "This will uninstall git by removing /usr/local/git/**/*, /etc/paths.d/git, /etc/manpaths.d/git" | |
printf "Type 'yes' if you sure you wish to continue: " | |
read response | |
if [ "$response" == "yes" ]; then | |
sudo rm -rf /usr/local/git/ |
var os = require("os"); | |
//Create function to get CPU information | |
function cpuAverage() { | |
//Initialise sum of idle and time of cores and fetch CPU info | |
var totalIdle = 0, totalTick = 0; | |
var cpus = os.cpus(); | |
//Loop through CPU cores |
#Linux - Running a Node Service (PM2) PM2 is a replacement for Forever which is used to run Node services (see http://devo.ps/blog/2013/06/26/goodbye-node-forever-hello-pm2.html). It has a number of advantages over forever:
license: gpl-3.0 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// @credit: http://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer | |
// From Buffer to ArrayBuffer: | |
function toArrayBuffer(buffer) { | |
var ab = new ArrayBuffer(buffer.length); | |
var view = new Uint8Array(ab); | |
for (var i = 0; i < buffer.length; ++i) { | |
view[i] = buffer[i]; | |
} |
var elements = document.querySelectorAll("div"), | |
callback = (el) => { console.log(el); }; | |
// Spread operator | |
[...elements].forEach(callback); | |
// Array.from() | |
Array.from(elements).forEach(callback); | |
// for...of statement |
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.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
Last updated 2020/03/04
Some links from twitter on the topic of parsing PSD files (haven't looked into them in details). PSD include a flattened rasterized image so this is easy to load if that's the only thing you need. Most software / librairies have support for extracting this flattened data (e.g. stb_image.h does).
However if you want access to individual layers, render non-rasterized layers, emulate every photoshop features, extract or apply effects with more granularity, more code is needed. May range from easy to lots-of-work depending on what exactly you need.
As far as I know there isn't a trivial stb-like ready-to-use C++ library to do that sort of things. Posting all links here. Some are probably bloated or hard to use into your project, some lacking features.
TODO: Actually look into the pros/cons of all those.