Setting NODE_ENV=production
causes these libraries and tools to behave as follows:
npm:
install
will not install devDependenciesshrinkwrap
will not install devDependenciesprune
will remove devDependencies
yarn:
{- | |
The comparison operators are non-associative and not composable. | |
Thus it is illegal to write: 1 < 2 < 3 | |
The input types of < (Int) does not match the output type (Bool). | |
1 < 2 < 3 can however be written in math notation, because it denotes: | |
(1 < 2) && (2 < 3) or (1 < 2) ^ (2 < 3) | |
It is however possible to create a new ternary operator that supports such a | |
notation! | |
-} |
var express = require('express'), | |
request = require('request'); | |
var app = express(); | |
// Forward all requests from /api to http://foo.com/api | |
app.use('/api', function(req, res) { | |
req.pipe(request("http://foo.com/api" + req.url)).pipe(res); | |
}); |
#!/bin/sh | |
# This is for an expressjs node app, it uses npm + bower packages and pm2 to start the app | |
# [pm2](https://github.com/Unitech/pm2) | |
# Assumes you've created a [bare git repo](https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server) with on your server with git init --bare | |
# Adapted from http://javascript.tutorialhorizon.com/2014/08/17/push-to-deploy-a-nodejs-application-using-git-hooks/ | |
PORT=1337 | |
APP_NAME="app-name" | |
APP_ROOT="/var/www/app" |
//Bend Three JS plane geometry with bezier curve | |
//Curved plane generation, bezier curve plane, | |
function bendPlaneGeometry(planeGeometry, centerBendZ) | |
{ | |
var curve = new THREE.CubicBezierCurve3( | |
planeGeometry.vertices[0], | |
new THREE.Vector3(planeGeometry.parameters.width/2, 0, centerBendZ ), | |
new THREE.Vector3(planeGeometry.parameters.width/2, 0, centerBendZ ), | |
planeGeometry.vertices[(planeGeometry.vertices.length/2) - 1] | |
); |
Setting NODE_ENV=production
causes these libraries and tools to behave as follows:
npm:
install
will not install devDependenciesshrinkwrap
will not install devDependenciesprune
will remove devDependenciesyarn:
Vue events don't bubble the component tree on their own. However when writing wrapper components this can be the desired behaviour.
This code registers a global bubble
directive which allows to re-emit all given events:
Let's say we want to bubble events start
, accelerate
and brake
of our component Car
.
Without any help, we'd roughly have to do this:
I used to have a site bookmarked with a table of all these functions, but the link is dead. Here's a matrix of Option and Result conversion functions. These become second nature once you have used Rust for any significant length of time, but it's useful to have a table reference.
For each of the below:
T
is the value possibly contained in an input Ok
Result
or Some
Option
.U
is a new value created by transforming or replacing an input T
. Note that when
U
appears in methods like map
, U ?= T
, for example by callingdeb http://archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse | |
#deb-src http://archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse | |
#deb-src http://archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse | |
#deb-src http://archive.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse |