Skip to content

Instantly share code, notes, and snippets.

View yllieth's full-sized avatar
🇨🇦

Sylvain RAGOT yllieth

🇨🇦
View GitHub Profile
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active November 15, 2024 16:58
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
var gulp = require('gulp');
var less = require('gulp-less');
gulp.task('less', function() {
return gulp.src('./style.less') // only compile the entry file
.pipe(less())
.pipe(gulp.dest('./build'))
});
gulp.task('watch', function() {
gulp.watch('./*.less', ['less']); // Watch all the .less files, then run the less task
@kjantzer
kjantzer / previous-git-tag.sh
Created March 2, 2015 20:01
Get Previous Git Tag (the one before the latest tag)
# http://stackoverflow.com/a/28818420/484780
git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`
@tkambler
tkambler / gist:71050d80f1a57ea83c18
Last active August 2, 2024 09:53
Calculate size of used LocalStorage space
/**
* Returns the total amount of disk space used (in MB) by localStorage for the current domain.
*/
var getLocalStorageSize = function() {
var total = 0;
for (var x in localStorage) {
// Value is multiplied by 2 due to data being stored in `utf-16` format, which requires twice the space.
var amount = (localStorage[x].length * 2) / 1024 / 1024;
total += amount;
}
@binarymax
binarymax / parseCIDRRange.js
Last active July 30, 2021 11:03
JavaScript function to parse a CIDR Range string into beginning and ending IPv4 Addresses
//MIT License
//Copyright (c) 2013, Max Irwin
//Parses a CIDR Range into beginning and ending IPv4 Addresses
//For example: '10.0.0.0/24'
//Returns ['10.0.0.0', '10.0.0.255']
var parseCIDR = function(CIDR) {
//Beginning IP address
var beg = CIDR.substr(CIDR,CIDR.indexOf('/'));
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"