Skip to content

Instantly share code, notes, and snippets.

View niccolomineo's full-sized avatar

Niccolò Mineo niccolomineo

View GitHub Profile
@niccolomineo
niccolomineo / google-spreadsheet-select-rightmost-sheet.gs
Created March 2, 2020 13:20
Select rightmost sheet in a Google Spreadsheet
function selectRightmostSheet()
{
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
var sheets = spreadsheet.getSheets()
spreadsheet.setActiveSheet(sheets[sheets.length-1])
}
selectRightmostSheet()
import os
import time
import mimetypes
import jwt
import google.auth.crypt
import google.auth.jwt
import requests
credentials_file = json.load(open(
os.path.dirname(os.path.realpath(__file__)) +
@niccolomineo
niccolomineo / toggle-bluetooth.applescript
Last active January 21, 2023 09:59
Toggles Bluetooth on Mac Os. Requires blueutil utility.
on run {input, parameters}
tell application "System Events"
set current_status to (do shell script "eval $(/usr/libexec/path_helper -s); blueutil | grep 'Power:' | cut -c8-")
if current_status = "0" then
do shell script "eval $(/usr/libexec/path_helper -s); blueutil -p 1"
beep
delay 0.25
beep
else
do shell script "eval $(/usr/libexec/path_helper -s); blueutil -p 0"
@niccolomineo
niccolomineo / get-ns-rgb-components-at-coords.swift
Last active August 7, 2018 15:11
Get NS RGB components at specific coordinates based on main display id
func getNSComponentsAt(x: Int, y: Int) -> NSColor {
let screenID = NSScreen.main!.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as! UInt32
let image: CGImage = CGDisplayCreateImage(CGDirectDisplayID(screenID), rect: CGRect(x: CGFloat(x), y: CGFloat(y), width: 1, height: 1))!
let bitmap = NSBitmapImageRep(cgImage: image)
let color = bitmap.colorAt(x: 0, y: 0)
self.redComponent = (color?.redComponent)!
self.greenComponent = (color?.greenComponent)!
self.blueComponent = (color?.blueComponent)!
@niccolomineo
niccolomineo / join-filter-angularjs.js
Created August 9, 2016 15:10
AngularJS - Filter - Join
// Filter: removes all non alphanumerical characters from input
myApp.filter('join', function() {
return function(input) {
input = input || '';
var output = input.replace(/\W/g, '');
return output;
};
});
@niccolomineo
niccolomineo / bbcode-to-html.js
Last active August 23, 2023 14:32
BBCode-to-HTML JS tokenizer + parser
var input = '[section][lang]Web writing (EN / IT / FR)[y]A lot[/y][/lang][/g][g Tools][lang]Git, AngularJS, GruntJS, Bower, Bash[y]A lot[/y][/lang][lang]Photoshop, Illustrator, InDesign[y]A lot[/y][/lang][/g][/section][p][i]Head in the clouds and feet on the ground web technologies enthusiast, with 6+ years across the web product value chain, aiming at 0 pending emails a day.[/i][/p][p]Hands-on practice across all web dev layers and in all stages of the web product Agile lifecycle, in Euro/regional institutions and private media agencies. Specific strengths:[/p] [*]API-first thinker[/*] [*]mixed technical/design skills[/*] [*]coolheadedness[/*] [*]stakeholder convergence and allocation[/*] [*]brand oriented/redundancy allergic view.[/*][p]Check out my full [a docs/niccolo_mineo_cv.pdf|résumé].[/p][q]The personal qualities and technical skills of Niccolò, as well as his ability to adapt to a multinational and multilingual environment, have made it very easy to integrate him in a well established team. We are s