Skip to content

Instantly share code, notes, and snippets.

@jean182
jean182 / z-index-scrapper.js
Created May 31, 2023 18:51
Get z-indexes from page.
/**
* Returns the z-index value of the element.
*
*
* @param element - The html element.
* @returns the element zIndex.
*
*/
const getZIndex = (element) => getComputedStyle(element).zIndex;

Ideas

  1. Prefer the usage of native methods, don't rely too much on lodash. Examples:
    1. We tend to over use isEmpty and there're many native ways to do it:
     import { isEmpty } from "lodash-es";
    
     /* When an array is present or does not have values */
import React, { Component } from "react";
import { connect } from "react-redux";
import PropTypes from "prop-types";
import { isEmpty, isUndefined } from "lodash-es";
import { makeCurrentLevel } from "redux-modules/location/hierarchy";
const LevelOption = props => {
const { level } = props;
if (!isEmpty(level)) {
const { id, attributes } = level;
@jean182
jean182 / bitbucket-pipelines.yml
Created December 18, 2018 03:29
Bitbucket Pipelines example
image: starefossen/ruby-node:2-5
pipelines:
branches:
master:
- step:
script:
- export HEROKU_APP_NAME=ci-conceptual
- chmod +x deploy-scripts/package_and_deploy.sh deploy-scripts/migrate.sh deploy-scripts/restart.sh
- deploy-scripts/package_and_deploy.sh
@jean182
jean182 / _errors.html.erb
Last active November 22, 2018 01:06
Bootstrap alert partial for form validation haml and erb
<% if object.errors.any? %>
<div class="alert alert-danger alert-dismissible fade show" id="error_explanation" role="alert">
<h4>
<%= pluralize(object.errors.count, "error") %>
prohibited
this object from being saved:
</h4>
<ul>
<% object.errors.full_messages.each do |msg| %>
<li>