Skip to content

Instantly share code, notes, and snippets.

You can use the "Replace" (or "Replace in Path" if you want to remove comments in multiple files) in the regular expression mode and then use this regular expression in the "Text to find" field:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*)
and replace it with an empty string. Then press "All" to apply this replacement to the entire file or all the selected files. This will remove all block comments and line comments from your file. If you want only block comments to be removed, use this regex instead:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)
And if you want to just remove line comments, you can use this regex:
([ \t]*//.*)
However, I should warn that this works only %99.99 of times. You might have a string variable defined in your file like:
@william-lohan
william-lohan / search.js
Created October 17, 2015 17:32
creates object from query string
var args = new (function (search) {
if (search.length > 1) {
for (var aItKey, nKeyId = 0, aCouples = search.substr(1).split("&"); nKeyId < aCouples.length; nKeyId++) {
aItKey = aCouples[nKeyId].split("=");
if(aItKey.length > 1){
var arg = decodeURIComponent(aItKey[1]);
this[decodeURIComponent(aItKey[0])] = isNaN(arg) ? arg : parseInt(arg);
} else {
this[decodeURIComponent(aItKey[0])] = true;
}
CanvasRenderingContext2D.prototype.setImageSmoothing = function(enabled) {
this.mozImageSmoothingEnabled = enabled;
this.webkitImageSmoothingEnabled = enabled;
this.msImageSmoothingEnabled = enabled;
this.imageSmoothingEnabled = enabled;
};
CanvasRenderingContext2D.prototype.isVisible = function(x, y, width, height) {
var visible = false;
if(x+width >= 0 && y+height >= 0) {
HTMLProgressElement.prototype.toString = function(){
return Math.round(this.position*100).toString() + "%";
};
HTMLProgressElement.prototype.update = function(value){
this.value = value;
var percentString = this.toString();
this.innerHTML = percentString;
this.setAttribute("data-display", percentString);
};
HTMLCanvasElement.prototype.scaleToFit = function(width, height) {
var scaleX = width / this.width;
var scaleY = height / this.height;
this.style.transformOrigin = "0 0";
this.style.transform = "scale(" + Math.min(scaleX, scaleY) + ")";
};
HTMLCanvasElement.prototype.scaleToCover = function(width, height) {
var scaleX = width / this.width;
var scaleY = height / this.height;
@william-lohan
william-lohan / webpack.config.js
Created September 8, 2016 18:05
webpack for agular
/// <binding />
/**
* @see http://webpack.github.io/docs/configuration.html
*/
var path = require('path');
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
@william-lohan
william-lohan / Ultima.d.ts
Created October 4, 2016 16:23
PrimeFaces Ultima TypeScript definition
interface UltimaStatic {
init(app: HTMLElement): void;
//_bindEvents(): void;
deactivateHorizontalMenu(): void;
activate(item: JQuery): void;
deactivate(item: JQuery): void;
deactivateItems(items: JQuery, animate: boolean): void;
enableModal(): void;
disableModal(): void;
@william-lohan
william-lohan / Rio.d.ts
Created October 4, 2016 16:40
PrimeNG Rio TypeScript definition
interface RioStatic {
init(): void;
bindEvents(): void;
isMobile(): boolean;
initRipple(): void;
}
/**
* PrimeNG Rio Layout
import { Component, OnInit, ElementRef } from '@angular/core';
@Component({
template: `
<!-- native element reference -->
<div id="source0"
style="background-color: red; height: 20px;"
draggable="true">
</div>
@william-lohan
william-lohan / dialog.js
Last active January 18, 2017 00:33
angularlink
CKEDITOR.dialog.add('routerLinkDialog', function (editor) {
return {
// Basic properties of the dialog window: title, minimum size.
title: 'Router Link Properties',
minWidth: 200,
minHeight: 100,
// Dialog window content definition.
contents: [
{
// Definition of the Basic Settings dialog tab (page).