Skip to content

Instantly share code, notes, and snippets.

View pgilad's full-sized avatar
🔭

Gilad Peleg pgilad

🔭
View GitHub Profile
@ngryman
ngryman / README.md
Last active January 16, 2023 14:07
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
@TheBigSadowski
TheBigSadowski / anon.js
Last active April 27, 2021 11:18
Random IP address generator for anonymizing data.
randomByte = function() {
return Math.round(Math.random()*256);
}
randomIp = function() {
var ip = randomByte() +'.' +
randomByte() +'.' +
randomByte() +'.' +
randomByte();
if (isPrivate(ip)) return randomIp();
@murtaugh
murtaugh / cursor-reset.css
Last active May 11, 2023 17:28
CSS Cursor Reset
html,
body {
cursor: default;
}
code {
cursor: text;
}
/*
@weotch
weotch / main.js
Last active March 13, 2016 12:23
Backbone routing example using require.js
// 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(),
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@pgilad
pgilad / gaInit.js
Last active June 22, 2016 22:15
Google Analytics ga.js for chrome extensions - snippit that doesn't report on development enviornment
//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];
@nisaacson
nisaacson / README.md
Last active December 9, 2019 01:17
Vim Javascript indentation via esformatter. Idea insired by http://yieldthedog.github.io/blog/2013/03/01/invoke-js-beautify-in-vim/
@kjantzer
kjantzer / backbone.collection.saveToCSV.js
Last active May 14, 2017 10:21
Backbone.Collection.saveToCSV() — adds ability to save all of the collections models as a CSV file. NOTE: only tested on Chrome; may not work on all browsers, but would work well for packaged Chrome apps.
/*
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)
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 30, 2024 23:36
how to delete a git tag locally and remote
# 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
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

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.

Possible solutions