Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.
- Go to
settings. - Search for
live templates. - Under the javascript section you should be able to manage your templates.
| randomByte = function() { | |
| return Math.round(Math.random()*256); | |
| } | |
| randomIp = function() { | |
| var ip = randomByte() +'.' + | |
| randomByte() +'.' + | |
| randomByte() +'.' + | |
| randomByte(); | |
| if (isPrivate(ip)) return randomIp(); |
| html, | |
| body { | |
| cursor: default; | |
| } | |
| code { | |
| cursor: text; | |
| } | |
| /* |
| // This our standard require js bootstrap file. It assumes you are using the | |
| // require-jquery.js file that require.js provides | |
| // Set the require.js configuration for the application | |
| require.config({ | |
| // Base path used to load scripts | |
| baseUrl: 'js/', | |
| // Prevent caching during dev | |
| urlArgs: "bust=" + (new Date()).getTime(), |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| //replace UA-XXXXXXXX-X *ONLY* with your real UA Account ID. | |
| //DO not replace the UA-99999999-X with anything, as that is the point of this. | |
| var _gaq = _gaq || []; | |
| (function () { | |
| var ga = document.createElement('script'); | |
| ga.type = 'text/javascript'; | |
| ga.async = true; | |
| ga.src = 'https://ssl.google-analytics.com/ga.js'; | |
| var s = document.getElementsByTagName('script')[0]; |
You can configure esformatter by changing ~/.esformatter See the esformatter default https://github.com/millermedeiros/esformatter/blob/master/lib/preset/default.json for configuration examples.
You will need the esformatter binary available in your path to run the indent command
npm install -g esformatter| /* | |
| Save To CSV 0.0.2 | |
| @author Kevin Jantzer, Blackstone Audio | |
| @since 2015-01-16 | |
| intial code from http://stackoverflow.com/a/14966131/484780 | |
| TODO | |
| - needs improved (objects as values) |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.