Skip to content

Instantly share code, notes, and snippets.

View smokills's full-sized avatar

Vito Famiglietti smokills

View GitHub Profile
@smokills
smokills / install_marketing_base.sh
Last active December 19, 2017 14:10
CAFFEINA marketing base installer
#!/usr/bin/env bash
which -s brew
if [[ $? != 0 ]] ; then
printf "Brew not found. Installing brew... \n"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
printf "Brew already installed. Updating current version... \n"
brew update
@smokills
smokills / gist:b982e49e89647c7aaf93de42e31526be
Created May 29, 2017 08:21 — forked from ptz0n/gist:1646171
Recursive merge of arrays with integer keys
<?php
/**
* Merge two dimensional arrays my way
*
* Will merge keys even if they are of type int
*
* @param array $array1 Initial array to merge.
* @param array ... Variable list of arrays to recursively merge.
*
<?php
function array_variation($old, $new) {
$new_map = array_flip(array_values($new));
$old_map = array_flip(array_values($old));
return [
"added" => array_filter($new, function($e) use ($old_map) {
return !isset($old_map[$e]);
}),
@smokills
smokills / extract_field.php
Last active March 29, 2017 08:33
Return an array that contains the value of the given column name
<?php
function extract_field($object, $field) {
return array_column(
array_map(function($e) {
return (array)$e;
}, (array)$object),
$field);
}
var RomanNumerals = {
toRoman: function(number) {
var romans = [
[1000, 'M'],
[900, 'CM'],
[500, 'D'],
[400, 'CD'],
[100, 'C'],
[90, 'XC'],
[50, 'L'],

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {