Deriving a new Array from an existing Array:
['■','●','▲'].slice(1, 3) ⟼ ['●','▲']
['■','●','■'].filter(x => x==='■') ⟼ ['■','■']
['▲','●'].map(x => x+x) ⟼ ['▲▲','●●']
['▲','●'].flatMap(x => [x,x]) ⟼ ['▲','▲','●','●']X-MAS CTF 2020 was my first CTF – I do ROM hacking, fan translation, and hardware modding, but I haven't done much hacking related to modern systems, so I was a wee bit worried there wouldn't be many challenges suited to my skillset. Imagine my surprise and delight, then, when I saw the challenge Ken Kutaragi's Secret Code, which consists of a PlayStation executable! And wouldn't you know it? I've hacked away at quite a few PS1 games in my day! Not many people solved it, likely because it requires quite niche skills – so let me share those with you!
The challenge description is as follows.
| import React from 'react'; | |
| export function createStrictContext(options = {}) { | |
| const Context = React.createContext(undefined); | |
| Context.displayName = options.name; | |
| function useContext() { | |
| const context = React.useContext(Context); | |
| if (!context) { | |
| throw new Error(options.errorMessage || `${name || ''} Context Provider is missing`); | |
| } |
How to get Pull Requests data using GitHub in the browser, or using the API to allow for automating reporting or building in values into a website.
| import { createHash, randomBytes } from 'crypto'; | |
| import * as request from 'request'; | |
| /** | |
| * The configuration object | |
| * | |
| * @export | |
| * @interface IAuthServiceConfig | |
| */ | |
| export interface IAuthServiceConfig { |
| //@flow | |
| import request from 'request' | |
| import crypto from 'crypto' | |
| import rp from 'request-promise' | |
| export type AuthServiceConfig = { | |
| authorizeEndpoint: string, | |
| clientId: string, | |
| audience: string, | |
| scope: string, |
The benchmarks used by Marko, with one benchmark containing only a single component with ~50 lines of code, and the other 3 components with one of them fully static markup, are typical micro-benchmarks created to the advantage of certain implementation details. They are too isolated and too trivial to justify across-the-board performance claims.
For client-side performance I recommend using the 3rd party js-framework-benchmark as a more neutral reference; the benchmark tests a much bigger workload and covering a much more comprehensive performance scenarios. According to the data from the latest round Vue actually outperforms Marko. That said, even this benchmark doesn't reflect real world performance where much more overhead comes from big component trees.
Vue has significantly improved SSR performance for
| (function (global, document, url) { | |
| var calls = []; | |
| var spy = {}; | |
| var methods = ['config', 'install', 'setUserContext', 'captureException']; | |
| for (var i = 0, method; method = methods[i]; i += 1) { | |
| spy[method] = (function (name) { | |
| return function () { | |
| calls.push([name, arguments]); | |
| return this; |
| { | |
| "presets": [ | |
| ["es2015", { | |
| "es2015": { | |
| "loose": true, | |
| "modules": false | |
| } | |
| }], "react" | |
| ] | |
| } |