Skip to content

Instantly share code, notes, and snippets.

View Blade helpers for PhpStorm.md
@bgaze
bgaze / vanilla-js-window-size.js
Last active Sep 2, 2019 — forked from joshcarr/window-height-width.js
[Vanilla JS] Get window dimensions
View vanilla-js-window-size.js
const windowSize = () => {
let body = document.getElementsByTagName('body')[0];
return {
width: window.innerWidth || document.documentElement.clientWidth || body.clientWidth,
height: window.innerHeight || document.documentElement.clientHeight || body.clientHeight
};
};
@bgaze
bgaze / bash-aliases
Last active Mar 15, 2021
A collection of console dev helpers
View bash-aliases
################################################################################
# INSTALLATION #
# #
# Simply save this file somewhere on your computer then import it into #
# your "~/.bashrc" file : #
# #
# if [ -f ~/path/to/bash-aliases ]; then #
# . ~/path/to/bash-aliases #
# fi #
# #
@bgaze
bgaze / umd-pattern.js
Created Mar 17, 2019
Javascript Universal Module Definition pattern
View umd-pattern.js
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], function (jQuery) {
return (root.myfn = factory(jQuery));
});
} else if (typeof module === "object" && module.exports) {
module.exports = (root.myfn = factory(require("jquery")));
} else {
root.myfn = factory(root.jQuery);
}
@bgaze
bgaze / gulp-pipable.js
Last active Mar 17, 2019
Gulp pipable function template
View gulp-pipable.js
// Install and import through2
// npm install --save-dev through2
const through = require('through2');
// Declare the function
var myfn = function () {
return through.obj(function (input, encoding, callback) {
// Get current stream content.
let content = String(input.contents);