azu/typescript1.5-es6module-npm at tsconfig-gulp
tsconfigが未対応なtsc1.4でもtsconfig.jsonをただの設定ファイル置き場として使う例。
filesGlob
はatom-typescriptの独自拡張だけど
.
├── README.md
├── build
│ ├── bundle.js
(function(){ | |
// create our custom link tag for the stylesheet | |
var url = "https://www.example.com/static/app.css"; // IMPORTANT: this is the CSS that contains your @font-face rules | |
var head = document.getElementsByTagName('head')[0]; | |
var link = document.createElement('link'); | |
link.type = "text/css"; | |
link.rel = "stylesheet" | |
link.href = url; | |
// append the stylesheet to the head |
// Test Page: https://keen-northcutt-3190bd.netlify.com/standard-load.html | |
// Paste below into the WPT Inject Script textarea. | |
(function(){ | |
var montserratBold = new FontFace('montserratbold_italic', 'url(fonts/montserrat-bolditalic-webfont.woff2)', { | |
display: 'swap', // test the page using 'swap' | |
weight: '700' | |
}); | |
document.fonts.add(montserratBold); |
azu/typescript1.5-es6module-npm at tsconfig-gulp
tsconfigが未対応なtsc1.4でもtsconfig.jsonをただの設定ファイル置き場として使う例。
filesGlob
はatom-typescriptの独自拡張だけど
.
├── README.md
├── build
│ ├── bundle.js
from sys import argv | |
import re | |
# open the file and get read to read data | |
file = open(argv[1], "r"); | |
p = re.compile("\d+"); | |
# initialize the graph | |
vertices, edges = map(int, p.findall(file.readline())) | |
graph = [[0]*vertices for _ in range(vertices)] |
const {performance} = require('perf_hooks'); | |
// using hrtime API | |
const hrBefore = process.hrtime(); | |
setTimeout(function () { | |
const hrAfter = process.hrtime(hrBefore); | |
console.log(`Using hrtime ${hrAfter[0] * 1e3 + hrAfter[1] / 1e6}ms`); |
# SOURCE: @zhouyanlt https://gist.github.com/yevrah/21cdccc1dc65efd2a4712781815159fb#gistcomment-2695800 | |
sudo yum install -y gcc git ncurses-devel | |
git clone https://github.com/vim/vim.git ~/vim | |
cd ~/vim/src | |
make distclean # if you built Vim before | |
make -j8 | |
sudo make install | |
cp -ru ~/vim/src/vim /usr/bin # overwrites /usr/bin/vim w/o confirmation |
#Error management in gulp
Sucking at something is the first step to becoming sorta good at something
No one can assure you, that plugins will run smooth in any circumstances (except for tests - they could), so neither should you convince anyone, that your plugin will never break. Only thing, that you could possibly do (if something gone wrong) - is gracefully inform your plugin user, that something went wrong and die.
We are will use this plugin from beginning to demonstrate error management. Suppose you have a task in gulpfile.js
that contains this code (we modified it a little bit to be closer to real-usage):
var coffee = require('gulp-coffee');
var fetch = require('node-fetch') | |
async function getDataFromAPI() { | |
let response = await fetch("https://api.github.com/users/up1") | |
let data = await response.json() | |
console.log(JSON.stringify(data, null, "\t")) | |
} | |
getDataFromAPI() |
Краткая характеристика:
Плюсы:
<body> | |
<div id="⚛️"></div> | |
<script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script> | |
<script type="text/babel"> | |
ReactDOM.render(<div>Hello World!</div>, document.getElementById('⚛️')) | |
</script> | |
</body> |