Did you know that it is rather easy to setup a VM to test your NixOs configuration?
# flake.nix
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs). | |
# So here's a minimal Gist which worked for me as an install on a new M1 Pro. | |
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration | |
# | |
# Let's get started | |
# | |
# Let's install nix (at the time of writing this is version 2.5.1 | |
curl -L https://nixos.org/nix/install | sh | |
# I might not have needed to, but I rebooted |
# For linux python 3 instructions see https://gist.github.com/softwaredoug/a871647f53a0810c55ac | |
# Install python manager | |
brew install pyenv | |
# Install virtual environment manager | |
brew install pyenv-virtualenv | |
# Update your .zshrc |
function saveSomething(something, callback){ | |
var saved = righto(saveValue, something); | |
var updatedLastSavedTime = righto(updateLastSaveTime); | |
// We want the result of `saved`, but only after `updatedLastSavedTime` succeeds. | |
var result = righto.after(saved, updatedLastSavedTime); | |
result(callback); | |
} |
An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.
function bindContext(object){ | |
return new Proxy({ | |
get: function(target, key){ | |
if(typeof target[key] === 'function' && !target.hasOwnProperty(key)){ | |
return target[key].bind(target); | |
} | |
return target[key]; | |
} | |
}); |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |