Skip to content

Instantly share code, notes, and snippets.

View fbedussi's full-sized avatar

Francesco Bedussi fbedussi

View GitHub Profile
@fbedussi
fbedussi / getTransitionDuration
Last active September 18, 2017 10:02
Return the transition duration (in millisecond) for the specified property on the specified element
/**
* @desc returns the duration in milliseconds of a CSS transition on the element $el for the given property
* @param {type} $el
* @param {type} property = 'transform'
* @returns {type}
*/
function getTransitionDuration($el, property = 'transform') {
return $el
.css('transition')
.split(',')
function shuffle(array) {
for(var j, x, i = array.length; i; j = parseInt(Math.random() * i), x = array[--i], array[i] = array[j], array[j] = x);
return array;
}
@fbedussi
fbedussi / getRootOf.js
Created October 5, 2016 20:04
Get root prototype on an object
function getRootOf(obj) {
var proto = Object.getPrototypeOf(obj);
while (!proto.hasOwnProperty('id')) {
proto = Object.getPrototypeOf(proto);
}
return proto;
}
var Obj = {id: 1}
@fbedussi
fbedussi / .gitconfig
Last active January 2, 2019 13:46
My .gitconfig
[http]
sslVerify = false
sslCAinfo = C:/Program Files/Git/usr/ssl/certs/ca-bundle.crt
sslCAinfo = C:/Program Files/Git/usr/ssl/certs/ca-bundle.trust.crt
[core]
autocrlf = true
excludesfile = C:\\Users\\bedussif\\Documents\\gitignore_global.txt
editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor
ignorecase = false
[user]
@fbedussi
fbedussi / objHasDeepProp.js
Created October 5, 2017 08:26
check if an object exsits and if it has the specified nested property
export default const objHasDeepProp = (obj, deepProp) => {
const props = deepProp.split('.');
var objToTest = obj;
var result = true;
if (!obj) {
return false;
}
for (let i = 0; i < props.length; i++) {
@fbedussi
fbedussi / jquery.fadecss.js
Created October 5, 2017 08:28
Apply class to allow fade in and fade out management via CSS transitions, invisible elements are in "display: none" to be invisible even to screen readers
(function ($) {
$.fn.fadeCss = function (action) {
try {
var defaultOptions = {
hideClass: 'hide',
fadeInClass: 'fadeIn',
fadeOutClass: 'fadeOut',
zeroOpacityClass: 'transparent',
fullOpacityClass: 'opaque',
if (!('indexedDB' in window)) {
//throw new Error('This browser doesn\'t support IndexedDB');
}
var db;
const openDb = (dbName, user) => new Promise((resolve, reject) => {
const request = indexedDB.open(dbName);
var newDb = false;
@fbedussi
fbedussi / keybindings.json
Created February 28, 2019 14:54
VS Code custom keybindings
// Inserire i tasti di scelta rapida in questo file per sovrascrivere i valori predefiniti
[
{
"key": "ctrl+w ctrl+v",
"command": "workbench.action.splitEditor"
},
{
"key": "shift+ctrl+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
@fbedussi
fbedussi / DefaultKeyBinding.dict
Created March 7, 2019 13:17 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
// Place your key bindings in this file to override the defaults
[
{
"key": "shift+cmd+g",
"command": "-workbench.action.terminal.findPrevious",
"when": "terminalFindWidgetFocused"
},
{
"key": "shift+cmd+g",
"command": "-workbench.action.terminal.findPreviousTerminalFocus",