Skip to content

Instantly share code, notes, and snippets.

View lisotton's full-sized avatar

Leandro Isotton lisotton

  • European Commission
  • Brussels, Belgium
View GitHub Profile
@lisotton
lisotton / yii2-debug-external-assets.patch
Last active October 29, 2023 10:15
Yii2 Debug bar using external assets
--- src/Module.php
+++ src/Module.php
@@ -354,7 +354,25 @@
*/
protected function resetGlobalSettings()
{
- Yii::$app->assetManager->bundles = [];
+ Yii::$app->assetManager->bundles = [
+ 'yii\web\JqueryAsset' => [
+ 'js' => ['https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js'],
@lisotton
lisotton / README.md
Last active July 12, 2019 09:35 — forked from sdennler/A Sad Web App Notifier
Bring the necessary Desktop Notification to Outlook Web App.

Synopsis

Outlook Web App has no Desktop Notification support. Probably because IE doesn't support it as well...

Motivation

I missed to much mails because this feature is missing...

Installation

@lisotton
lisotton / json_ruby_metrics.sh
Last active August 29, 2015 14:17
Extract Flay, Flog and SimpleCov metrics from Ruby project and post a JSON with these metrics in some webservice.
TOTAL_COVERAGE=$(grep -i covered_percent coverage/index.html | head -n 1 | sed -n 's/.*>\([0-9]\+\.[0-9]\+\).*/\1/p')
CONTROLLERS_COVERAGE=$(awk '/group_name.+Controllers/{getline; print}' coverage/index.html | sed -n 's/.*>\([0-9]\+\.[0-9]\+\).*/\1/p')
MODELS_COVERAGE=$(awk '/group_name.+Models/{getline; print}' coverage/index.html | sed -n 's/.*>\([0-9]\+\.[0-9]\+\).*/\1/p')
HELPERS_COVERAGE=$(awk '/group_name.+Helpers/{getline; print}' coverage/index.html | sed -n 's/.*>\([0-9]\+\.[0-9]\+\).*/\1/p')
UNGROUPED_COVERAGE=$(awk '/group_name.+Ungrouped/{getline; print}' coverage/index.html | sed -n 's/.*>\([0-9]\+\.[0-9]\+\).*/\1/p')
RELEVANT_LINES=$(grep -A3 "AllFiles" coverage/index.html | tail -1 | sed -n 's/.*>\([0-9]\+\).*/\1/p')
COVERED_LINES=$(grep -A4 "AllFiles" coverage/index.html | tail -1 | sed -n 's/.*>\([0-9]\+\).*/\1/p')
FLOG_OUTPUT=$(find app -name \*.rb | xargs bundle exec flog --score)
FLOG_TOTAL=$(echo "$FLOG_OUTPUT" | head -n 1 | sed -n 's/: flog total//p' | tr -d '[[:space:]]')
FLOG_METHOD_A
@lisotton
lisotton / identify.sh
Last active September 7, 2015 15:59
Create relationship between pictures and runner number
#!/bin/zsh
CSV="identificador.csv"
FILES=$(ls *.jpg)
TITLE="Identificador de fotos..."; echo -en "\033]0;$TITLE\a"
CSV_IDENTIFIERS=$(awk -F "\"*,\"*" '{print $1}' $CSV)
NON_IDENTIFIED=$(echo "$CSV_IDENTIFIERS\n$FILES" | sort | uniq -u)
set -f; IFS=$'\n'
NON_IDENTIFIED_ARRAY=($(echo $NON_IDENTIFIED))
@lisotton
lisotton / add-project.sh
Created January 19, 2015 11:50
Add project name to all Drupal modules
#!/bin/bash
# Find modules without project
INFOS=`find sites/*/modules -name '*.info' | xargs -I {} grep -iL 'project' {}`
for INFO in $INFOS; do
PROJECT=`basename $INFO | sed 's/\.info//'`
echo "Add \"project = $PROJECT\" in: $INFO ? [Y/n]"
read yes_no
if [ "$yes_no" != "n" ]; then
echo -e "\nproject = $PROJECT" >> $INFO