Skip to content

Instantly share code, notes, and snippets.

View bionicvapourboy's full-sized avatar

Mosè Raguzzini bionicvapourboy

View GitHub Profile
const myArr = [[1,2,[3]],4];
const flatten = list => list.reduce(
(a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []
);
flatten(myArr); // [1, 2, 3, 4,]
@bionicvapourboy
bionicvapourboy / WiFiFix.sh
Last active February 6, 2019 21:08
With some Access Poits or WiFi Extenders I need to reconnect in order to restore the normal connectivity
# With some access point my wifi loses connection
# The connection is usually restored as long I reconnect to the AP
# This script detects ping failure to the Google DNS server
# then try to turn off and on wifi network
# WARNING: It does not check the default WiFi to reconnect to
status="OFF";
while true
do
if ping -q -c 1 -W 1 8.8.8.8 &>/dev/null;then
{{ "{% if form_filter is defined %}" }}
<div class="accordion" id="record_filter">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#record_filter" href="#record_filter_collapse">
<i class="icon-search"></i> Filtra risultati
</a>
</div>
<div id="record_filter_collapse" class="accordion-body collapse{{ "{{ filter is defined and filter ? ' in' : '' }}" }}">
<div class="accordion-inner">
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: function() { console.log("standard progress callback"); },
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);