2019-06-30

JavaScript - jQuery Filter

// Array of json objects
let json_array = [
{
"item_name": "United States"
, "item_property": "123"
},
{
"item_name": "United Arab Emirates"
, "item_property": "123"
},
{
"item_name": "Mexico"
, "item_property": "234"
}
];

// Filter
$(json_array).filter(function (index, value){
        return value.item_property === '123';
    });

JavaScript - jQuery Grep

// Arry of json objects
let json = [
{
"item_name": "United States"
, "item_property": "123"
},
{
"item_name": "United Arab Emirates"
, "item_property": "123"
},
{
"item_name": "Mexico"
, "item_property": "234"
}
];

// Grep to filter
$.grep( 
json
, function( item, index ) {
return item.item_property === '123';
}
);


2019-06-11

SCSS - Iconic Bootstrap implementation sampler

<span
    class="

        {{! Required class}}
        iconic

        {{! Icon name}}
        iconic-brush

        {{!3 versions for each, scaled depending on size}}
        iconic-sm {{!iconic-md}}{{!iconic-lg}}

        {{! Size }}
        iconic-size-sm {{!iconic-size-lg}}

        {{! Flip }}
        iconic-flip-horizontal-vertical {{!iconic-flip-horizontal}}{{!iconic-flip-vertical}}
       
        {{! Ignore the text in the span, if any }}
        iconic-text-replace
    "

    title="brush"

    aria-hidden="true"

>This text will be ignored</span>


PS. SCSS/SSAS.

SCSS - Basic inheritance example

.parent{
  background-color: red;
}
.child {
  @extend .parent;
}

MacOS - Terminal command history search

history | grep SEARCH_TERM_HERE

2019-06-04

Javascript - How to check if an isotope has already been instantiated or not

if($(".div-class-supposed-to-turn-into-an-isotope").hasClass('isotope')) {}


Credits...
https://stackoverflow.com/questions/16138404/isotope-metafizzy-how-to-check-if-an-element-has-already-been-initialized-as-an