Skip to content

Instantly share code, notes, and snippets.

View ifthenelse's full-sized avatar
🏎️
LIFE BE LIKE

Andrea Collet ifthenelse

🏎️
LIFE BE LIKE
View GitHub Profile
@ifthenelse
ifthenelse / jquery.getTransitionDuration.js
Last active September 4, 2018 09:13 — forked from mandelbro/jQuery-transitionend
Quick jQuery plugin to get the duration of a CSS transition for an element. Support multiple transition values
/**
* jQuery.getTransitionDuration
* A jQuery plugin to get transition-duration in milliseconds
* Works with multiple values and supports all browser vendor prefixes
*
* Usage with single transition-duration values $(div).getTsDuration()
* Usage with multiple transition-duration values $(div).getTsDuration("opacity") (otherwise would return the first)
*
* Based on a gist by Chris Montes https://gist.github.com/mandelbro/4067903
*/
@ifthenelse
ifthenelse / jQuery_plugin_UMD_boilerplate.js
Last active July 19, 2018 10:44
Boilerplate for jQuery plugin with UMD wrapper and requiremetn of external dependencies (in this case 'moment' and 'moment-timezone')
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'moment', 'moment-timezone'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = function(root, jQuery, moment) {
if (jQuery === undefined) {
// require('jQuery') returns a factory that requires window to
// build a jQuery instance, we normalize how we use modules
@ifthenelse
ifthenelse / Dynamic grid layout in SASS
Created June 27, 2017 16:23
Programmatically stack SASS breakpoints in a json-like structure and use them to create a grid system layout
$smallphone: 480px;
$phone: 640px;
$tablet: 768px;
$desktop: 1024px;
$wide: 1440px;
// Grid breakpoints map
$breakpoints: (small: null, medium: "screen and (min-width: 768px)", large: "screen and (min-width: 1440px)");
// Non-grid breakpoints map
alias nom='npm cache clean && rm -rf node_modules && mkdir node_modules && tmutil addexclusion $(pwd)/node_modules && touch node_modules/.metadata_never_index && npm install'
alias bom='bower cache clean && rm -rf bower_components && mkdir bower_components && tmutil addexclusion $(pwd)/bower_components && touch bower_components/.metadata_never_index && bower install'
@ifthenelse
ifthenelse / riepilogo.html
Created June 9, 2016 17:59
Header riepilgoo checkout
<section class="shop-checkout--cart section-without-vertical-margin layout-grid is-active">
<div class="row">
<div class="col small-12 medium-8 medium-shift-2 large-6 large-shift-3">
<header class="shop-checkout--cart--header">
<h2>Riepilogo ordini</h2>
</header>
<article id="cart-item-riso" class="shop-checkout--cart-item">
<div class="shop-checkout--cart-item--info riepilogo">
<p class="shop-checkout--cart-item--name bentonsanslight__big uppercase">
<span class="bentonsansbold">5 x</span> <a href="/shop-categoria.html" title="Riso" target="_self" class="shop-checkout--cart-item--link">Riso</a>
@ifthenelse
ifthenelse / stili.css
Last active April 5, 2016 15:50
Stili di prova per adattamento mobile della newsletter
<style type="text/css">
.bentonsansbook {
font-family: "Benton Sans Book", Verdana, "Helvetica Neue", Helvetica, "Trebuchet MS", Arial;
font-style: normal;
font-weight: normal;
color: #0e0e0e;
}
.bentonsanslight {
font-family: "Benton Sans Light", Verdana, "Helvetica Neue", Helvetica, "Trebuchet MS", Arial;
@ifthenelse
ifthenelse / sf2_aliases.sh
Last active March 16, 2016 11:37
Aliases collection for Symfony 2
#!/bin/sh
# If superuser warn and prompt to continue
prompt_exec_as_root () {
if [[ `whoami` = 'root' -o $(id -u) == 0 -a -z "$SUDO_COMMAND" ]]; then
/bin/echo "Warning: you're running the script as superuser.";
/bin/echo "This may cause directory permission issues and you'll probably be unable to access your files anymore. \nIn malmost all the cases you're adviced to run as regular user."
/bin/echo "Do you still want to continue? [Yes/No/Abort] (default: No) "
read REPLY;
else if [[ ! $REPLY -o $REPLY =~ ^[Nn][Oo]?$ -o $REPLY =~ ^[Aa]([Bb][Oo][Rr][Tt])?$ ]]; then
@ifthenelse
ifthenelse / retroarch_20160131-180023.txt
Created January 31, 2016 17:03
Libretro Retroarch dumpfile on 2016/01/31 at 6:00:23 PM
RetroArch [INFO] :: === Build =======================================RetroArch [INFO] :: [CPUID]: Features:
RetroArch [INFO] :: Version: 1.3.0
RetroArch [INFO] :: Git: 97e0c86
RetroArch [INFO] :: =================================================
RetroArch [INFO] :: [CPUID]: Features:
RetroArch [INFO] :: Looking for config in: "/storage/.config/retroarch/retroarch.cfg".
RetroArch [INFO] :: Config: loading config from: /storage/.config/retroarch/retroarch.cfg.
RetroArch [INFO] :: Threaded rarch_task started
RetroArch [INFO] :: Loading dynamic libretro core from: "/tmp/cores/genesis_plus_gx_libretro.so"
RetroArch [INFO] :: Environ SET_VARIABLES.
@ifthenelse
ifthenelse / .htaccess
Last active February 7, 2016 15:05
Redirect to the page which most suits the client's language settings. Choice is made by Apache server contextually to "Accept-Language" HTTP header values. Current example fallbacks to English page if no suitable language is found.
# Declare the file which contains the index of its traslations
DirectoryIndex index.html.var
AddHandler type-map .var
# Redirect to specific language by explicit URL request
# /en -> index.html
# /it -> index_it.html
# /es -> index_es.html
<IfModule mod_rewrite.c>
@ifthenelse
ifthenelse / wp-template.sublime-project
Created December 21, 2015 10:23
Sublime Text 3 project file template for Wordpress
{
"folders":
[
{
"follow_symlinks": true,
"path": "/",
"folder_exclude_patterns": [
".sass-cache",
".bundles",
"node_modules",