Skip to content

Instantly share code, notes, and snippets.

View dannypule's full-sized avatar
🎯
Focusing

Danny Pule dannypule

🎯
Focusing
View GitHub Profile
@dannypule
dannypule / settings.json
Last active October 22, 2016 19:04
Conditionally hide files “.js” and “.js.map” files in Visual Studio Code
{
"files.exclude": {
"**/*.js": {"when": "$(basename).ts"},
"**/*.map": {"when": "$(basename).map"}
}
}
<script id="polyfills_js" type="text/javascript"></script>
<script id="vendor_js" type="text/javascript"></script>
<script id="app_js" type="text/javascript"></script>
<script>
console.log('APP_ENVIRONMENT: ' + APP_ENVIRONMENT);
switch (APP_ENVIRONMENT) {
case 'DEVELOPMENT':
document.getElementById("polyfills_js").src = 'http://localhost:8085/polyfills.js';
var vendorJsInterval = setInterval(function () {
if (window.POLYFILLS_JS_LOADED) {
document.getElementById("vendor_js").src = 'http://localhost:8085/vendor.js';
var AssetsPlugin = require('assets-webpack-plugin');
...
output: {
path: helpers.root('dist'), // sets output folder to 'dist'
publicPath: '/', // tells webpack where we'll host the generated bundle
filename: '[name]_[hash].js', // output filename - e.g app.js or vendor.js
chunkFilename: '[id].chunk.js' //??
},
...
declare var window: any;
window.VENDOR_JS_LOADED = true;
...
declare var window: any;
window.POLYFILLS_JS_LOADED = true;
{
"app": {
"js": "/app_b95b26e6f55b3ce20310.js"
},
"polyfills": {
"js": "/polyfills_b95b26e6f55b3ce20310.js"
},
"vendor": {
"js": "/vendor_b95b26e6f55b3ce20310.js"
}
app_b95b26e6f55b3ce20310.js
assets.json
index.html
polyfills_b95b26e6f55b3ce20310.js
vendor_b95b26e6f55b3ce20310.js
@Directive({ selector: '[my-tooltip]' })
export class TooltipDirective implements OnDestroy {
@Input() tooltipTitle: string = '';
private id: string;
constructor(private tooltipService: TooltipService, private element: ElementRef) { }
@HostListener('mouseenter')
onMouseEnter(): void {
@dannypule
dannypule / json_to_csv.js
Created February 8, 2017 18:40
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];