A brief example on how to use npx
to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/ or watch it on YouTube https://www.youtube.com/watch?v=fSHWc8RTJug
<%-- version1: java style --%> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%@page import="java.util.Date"%> | |
<%@page import="java.util.Calendar"%> | |
<% pageContext.setAttribute("currentYear", java.util.Calendar.getInstance().get(java.util.Calendar.YEAR)); %> | |
Current year is: <c:out value="${currentYear}" /> | |
<%-- version2: JSTL style --%> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> |
A brief example on how to use npx
to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/ or watch it on YouTube https://www.youtube.com/watch?v=fSHWc8RTJug
# sudo apt-get install pv | |
$ pv app.js | nc 192.168.1.123 10000 |
First of all, please note that token expiration and revoking are two different things.
A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.
Quoted from JWT RFC:
public class Formatter { | |
/** | |
* The next piece of code is not formatted | |
* because of the @formatter annotations. | |
*/ | |
// @formatter:off | |
public void nonFormattedMethod() { | |
int sum = 1 + 2 + 3 + 4 + 5; | |
} |
#!/usr/bin/env python | |
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
# Written by Nathan Hamiel (2010) | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from optparse import OptionParser | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): |
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
Expands on Handling required parameters in ECMAScript 6 by Axel Rauschmayer.
The idea (which is credited to Allen Wirfs-Brock) is, in essence, to use default parameter values to call a function which throws an Error if the parameter is missing:
const throwIfMissing () => { throw new Error('Missing parameter') }