// test-code.js
add :: (number, number) => number
function add (x, y) {
return x + y
}
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
| function commonPrefixLen(names, sep) { | |
| const sc = sep.charCodeAt(0); | |
| for (let pos = 0; ; pos++) { | |
| for (let i = 0; i < names.length; i++) { | |
| let c = names[i].charCodeAt(pos) | |
| if (c && c == names[0].charCodeAt(pos)) { | |
| continue; | |
| } | |
| while (pos > 0 && names[0].charCodeAt(--pos) != sc) {} | |
| return pos; |
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 | |
| set -e | |
| cd "$(dirname "$0")" | |
| if [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] || [ "$1" = "" ]; then | |
| echo "Usage: $0 <port> [h2]" >&2 | |
| echo " h2 Serve over HTTP/2 with TLS using caddy" >&2 | |
| exit 1 | |
| fi |
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
| "use strict"; | |
| const fs = require('fs'); | |
| const https = require('https'); | |
| const outdir = __dirname + '/svg'; | |
| function DownloadSVG(codepoint) { | |
| return new Promise((resolve, reject) => { | |
| let cpstr = codepoint.toString(16).toLowerCase(); |
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
| // loaction: loaders/es-preset.js | |
| // This file is a combination of the following babel presets: | |
| // es2015, react, stage-0. | |
| // Difference is that the es2015-template-literals is taken out. Of the es2015 preset. | |
| // This allows us to run relay transformations on the code afterwards (which will then transform any remaining template literals). | |
| module.exports = preset({}); | |
| function preset(context, opts) { | |
| var moduleTypes = ["commonjs", "amd", "umd", "systemjs"]; | |
| var loose = false; |
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
| #pragma once | |
| #include <Foundation/Foundation.h> | |
| #include "common.h" | |
| @interface IconRequest : NSObject | |
| @property (readonly) BOOL canceled; | |
| @property (readonly) CGImageRef image; // null if canceled or failed | |
| - (void)cancel; | |
| @end |
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/bash | |
| set -e | |
| if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then | |
| echo "usage: ${0##*/} <video-input-file> [<gif-output-file>]" >&2 | |
| echo " if <gif-output-file> is not provided, <video-input-file> with" >&2 | |
| echo " filename extension replaced by \".gif\" is used" >&2 | |
| exit 1 | |
| fi |
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 from 'react'; | |
| const MIN_SCALE = 1; | |
| const MAX_SCALE = 4; | |
| const SETTLE_RANGE = 0.001; | |
| const ADDITIONAL_LIMIT = 0.2; | |
| const DOUBLE_TAP_THRESHOLD = 300; | |
| const ANIMATION_SPEED = 0.04; | |
| const RESET_ANIMATION_SPEED = 0.08; | |
| const INITIAL_X = 0; |
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
| /** | |
| * You may use this function with both 2 or 3 interval colors for your gradient. | |
| * For example, you want to have a gradient between Bootstrap's danger-warning-success colors. | |
| */ | |
| function colorGradient(fadeFraction, rgbColor1, rgbColor2, rgbColor3) { | |
| var color1 = rgbColor1; | |
| var color2 = rgbColor2; | |
| var fade = fadeFraction; | |
| // Do we have 3 colors for the gradient? Need to adjust the params. |