- Wei Lu: HTTP Headers - The Simplest Security - JSConf.Asia 2014
- Content-Security-Policy
- X-XSS-Protection
- Strict-Transport-Security
- X-Frame-Options
This file contains 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
/** | |
* ES6 way of removing nth array element in an immutable way | |
* @param [Array] arr | |
* @param [number] i | |
* @return [Array] | |
*/ | |
function removeNthEl (arr, i) { | |
return [ | |
...arr.slice(0, i), | |
...arr.slice(i + 1) |
This file contains 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
export function calcFitDimensions (target, boundries, upscale = false) { | |
if (!target.width || !target.height || !boundries.width || !boundries.height) { | |
return calcCenterPosition(target, boundries); | |
} | |
let imgRatio = target.width / target.height; | |
let newWidth; | |
let newHeight; | |
// if image is horizontal |
This file contains 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 {PureComponent, PropTypes} from 'react'; | |
export default class DelayMount extends PureComponent { | |
static propTypes = { | |
render: PropTypes.bool.isRequired, | |
children: PropTypes.any, | |
transitionEnterDelay: PropTypes.number.isRequired, | |
transitionLeaveTimeout: PropTypes.number.isRequired | |
} |
This file contains 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
// ... | |
function loggingMiddleware (req, res, next) { | |
const id = genReqId(req) | |
req.log = res.log = logger.child({reqId: id}) | |
req.log[useLevel]({req}, 'Recieved request') | |
res[startTime] = res[startTime] || Date.now() | |
if (!req.res) { req.res = res } | |
res.on('finish', onResFinished) |
I hereby claim:
- I am renarsvilnis on github.
- I am renarsvilnis (https://keybase.io/renarsvilnis) on keybase.
- I have a public key ASCqW6nmRyxAuawicthyZFzwvp-FVybO76yYRTzLcdfr7go
To claim this, I am signing this object:
This file contains 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
alert('Hello world!'); |
OlderNewer