Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.
| node_modules/ |
| // created this flow file to archive my starred repos | |
| // it prints the list of starred repos by github user | |
| // you can get TagUI here (macOS / Windows / Linux) | |
| // https://github.com/kelaberetiv/TagUI#set-up | |
| // usage #1 - copy or download this file, then run | |
| // tagui stars github_userid quiet chrome | |
| // usage #2 - if you want to run this gist directly |
First of all, please note that token expiration and revoking are two different things.
- Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
- Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.
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:
| # Redis Cheatsheet | |
| # All the commands you need to know | |
| redis-server /path/redis.conf # start redis with the related configuration file | |
| redis-cli # opens a redis prompt | |
| # Strings. |
| /** | |
| * This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
| * a base64 string. | |
| * This code is used in my startup, Zired. | |
| * Web: http://zired.io | |
| */ | |
| // You can either "yarn add aws-sdk" or "npm i aws-sdk" | |
| const AWS = require('aws-sdk') |
| /** | |
| * number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. | |
| * It formats a number to a string with grouped thousands, with custom seperator and custom decimal point | |
| * @param {number} number - number to format | |
| * @param {number} [decimals=0] - (optional) count of decimals to show | |
| * @param {string} [decPoint=.] - (optional) decimal point | |
| * @param {string} [thousandsSep=,] - (optional) thousands seperator | |
| * @author Felix Leupold <[email protected]> | |
| */ | |
| function number_format(number, decimals, decPoint, thousandsSep) { |
Translations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
| const Benchmark = require('benchmark'); | |
| const axios = require('axios'); | |
| const superagent = require('superagent'); | |
| var suite = new Benchmark.Suite; | |
| const targetUrl = 'http://httpbin.org/ip'; | |
| suite | |
| .add('axios', { |