Skip to content

Instantly share code, notes, and snippets.

View okonet's full-sized avatar

Andrey Okonetchnikov okonet

View GitHub Profile
@okonet
okonet / gradlew
Created May 17, 2014 21:41
gradle recursion example :)
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
@okonet
okonet / webpack.config.js
Last active September 19, 2016 22:31
Long-term caching with webpack example
var path = require('path');
var webpack = require('webpack');
var ManifestPlugin = require('webpack-manifest-plugin');
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
var WebpackMd5Hash = require('webpack-md5-hash');
module.exports = {
entry: {
vendor: './src/vendor.js',
main: './src/index.js'
// webpack.config.js
module.exports = {
entry: {
vendor: './src/vendor.js',
main: './src/index.js'
},
output: {
path: path.join(__dirname, 'build'),
filename: '[name].[hash].js'
}
// webpack.config.js
module.exports = {
...
output: {
...
filename: '[name].[chunkhash].js'
}
}
// webpack.config.js
module.exports = {
...
plugins: [
function() {
this.plugin("done", function(stats) {
require("fs").writeFileSync(
path.join(__dirname, "...", "stats.json"),
JSON.stringify(stats.toJson()));
});
// webpack.config.js
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
module.exports = {
// your config values here
plugins: [
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest"
})
<html>
<head>
<script>
//<![CDATA[
window.webpackManifest = {"0":"main.3d038f325b02fdee5724.js","1":"1.c4116058de00860e5aa8.js"}
//]]>
</script>
</head>
<body>
</body>
> webpack
Hash: 92670583f688a262fdad
Version: webpack 1.10.1
Time: 65ms
Asset Size Chunks Chunk Names
chunk-manifest.json 68 bytes [emitted]
vendor.6d107863983028982ef4.js 3.71 kB 0 [emitted] vendor
1.c4116058de00860e5aa8.js 107 bytes 1 [emitted]
@okonet
okonet / test.jsx
Last active January 8, 2016 22:15
What's more _readable_ in your opinion?
<Card>
<h4 className="TaskListItem_title">
<span className="TaskListItem_icon-type">
<Icon name={iconMap[type]}/>
</span>
{title} <span className="TaskListItem_id">#{id}</span>
</h4>
<div className="TaskListItem_stats">
<p className="TaskListItem_stat-item"><Icon name="code-fork"/> {commits}</p>
@okonet
okonet / esnextbin.md
Last active July 6, 2016 07:54
esnextbin sketch