[02:06 PM] acemarke: @Steven : a couple other thoughts on the whole NODE_ENV
thing. First, per my comments, it really is a Node concept. It's a system environment variable that Node exposes to your application, and apparently the Express web server library popularized using its value to determine whether to do optimizations or not
[02:08 PM] acemarke: Second, because of its use within the Node ecosystem, web-focused libraries also started using it to determine whether to they were being run in a "development" environment vs a "production" environment, with corresponding optimizations. For example, React uses that as the equivalent of a C #ifdef
to act as conditional checking for debug logging and perf tracking. If process.env.NODE_ENV
is set to "production"
, all those if
clauses will evaluate to false
.
Third, in conjunction with a tool like UglifyJS that does minification and removal of dead code blocks, a clause that is surrounded with if(process.env.NODE_ENV !== "development")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these three lines to CORSify your server for everyone. | |
Header set Access-Control-Allow-Origin "*" | |
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE" | |
Header set Access-Control-Allow-Headers "Content-Type, Authorization" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"strconv" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# LinuxのTimeZoneを変更 | |
# 参考 | |
# http://qiita.com/azusanakano/items/b39bd22504313884a7c3 | |
# タイムゾーンの変更 | |
cp /etc/localtime /etc/localtime.original | |
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react'; | |
import {SafeAreaView, StyleSheet, View, Button} from 'react-native'; | |
import { | |
RTCView, | |
mediaDevices, | |
MediaStream, | |
MediaStreamConstraints, | |
} from 'react-native-webrtc'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TypeError: Cannot destructure property 'resourceArn' of 'connection' as it is undefined. | |
# fix: use other way to check if instance is RDSDataClient | |
sed -i '' 's/params\[0\] instanceof RDSDataClient/params\[0\].constructor.name === "RDSDataClient"/g' node_modules/drizzle-orm/aws-data-api/pg/driver.js | |
# Error: The result contains the unsupported data type "CHAR". | |
# fix: cast CHAR to TEXT | |
sed -i '' 's/const proxy = async (params) => {/const proxy = async (params) => {\n params.sql = params.sql.replace(\/a.attidentity AS identity_type\/i, '\''a.attidentity::text AS identity_type'\''); \n params.sql = params.sql.replace(\/a.attgenerated AS generated_type\/i, '\''a.attgenerated::text AS generated_type'\'');/g' node_modules/drizzle-kit/bin.cjs | |
sed -i '' 's/const proxy = async (params) => {/const proxy = async (params) => {\n params.sql = params.sql.replace(\/con.contype AS constraint_type\/i, '\''con.contype::text AS constraint_type'\'');/g' node_modules/drizzle-kit/bin.cjs | |
# ERROR: bind |