Skip to content

Instantly share code, notes, and snippets.

View allejo's full-sized avatar

Vladimir Jimenez allejo

View GitHub Profile
@allejo
allejo / logger.sh
Created September 10, 2023 19:49
$ bzfs > logger.sh logs 5154
#!/bin/bash
log_location=$1
while read data
do
dt=`date +%Y-%m-%d`
port=$2
if [ ! -d "$log_location/$port" ]
@allejo
allejo / what-forces-layout.md
Created January 6, 2022 20:10 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@allejo
allejo / prompt.sh
Last active March 31, 2020 07:18
[My zsh prompt] The logic in my .zshrc file #zsh
#
# Make zsh tab complete case insensitive
#
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
autoload -Uz compinit && compinit
#
# IntelliJ IDE Terminals
#
@allejo
allejo / onblur.jsx
Last active May 10, 2019 17:42 — forked from pstoica/OnBlurComponent.jsx
onBlur for entire react component
var HelloMessage = React.createClass({
render: function() {
return <div tabIndex="1" onBlur={this.onBlur}>
Hello <input type="text" value="wat"/>
</div>;
},
onBlur: function(e) {
var currentTarget = e.currentTarget;
{% assign base = '' %}
{% assign depth = page.url | split: '/' | size | minus: 1 %}
{% if depth <= 1 %}
{% assign base = '.' %}
{% else %}
{% for d in (1..depth) %}
{% assign base = base | append: '..' %}
{% unless forloop.last %}
@allejo
allejo / _README.md
Last active September 7, 2017 08:52
Generate a Table of Contents for a Jekyll post with pure Liquid (License: BSD-3)
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
@allejo
allejo / docs.html
Last active January 31, 2017 19:48
<!-- relative link basehrefs -->
{% if page.path contains "index.md" %}
{% capture basehref %}{{ page.url }}{% endcapture %}
{% else %}
{% assign crumbs = page.url | split: '/' %}
{% assign stoppingpoint = crumbs | size | minus: 1 %}
{% for crumb in crumbs %}
{% if forloop.index == stoppingpoint %}
{% capture basehref %}{{basehref}}{{ crumb }}/{% endcapture %}
{% break %}
@allejo
allejo / division.html
Last active December 2, 2016 11:04
Do division in Liquid templates with support for decimals
{% capture whitespace %}
{% assign wholeNum = include.number | divided_by: include.divsor %}
{% assign remainder = wholeNum | times: include.divsor | minus: include.number | times: -1 %}
{% capture output %}{{ wholeNum }}.{% endcapture %}
{% for i in (1..include.decimals) %}
{% assign newNumer = remainder | times: 10 %}
{% assign workspace = newNumer | divided_by: include.divsor %}
{% assign remainder = workspace | times: include.divsor | minus: newNumer | times: -1 %}
<?php
class DateParserFilter extends \Twig_Extension
{
public function getFilters ()
{
return array(
new \Twig_SimpleFilter('parse_date', array($this, 'parseDate'))
);
}