Skip to content

Instantly share code, notes, and snippets.

View gabssnake's full-sized avatar

gabssnake gabssnake

  • Lyon
View GitHub Profile
@gabssnake
gabssnake / bash_profile
Last active December 17, 2015 15:19
bash_profile file for terminal
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php5.3.6/bin/:/opt/local/bin:/opt/local/sbin:$PATH
# coloring the terminal
# turn on colors
export CLICOLOR=1
# change colors
# http://www.macosxhints.com/article.php?story=20031025162727485
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
return support;
})();
// disable :hover on touch devices
// based on https://gist.github.com/4404503
// via https://twitter.com/javan/status/284873379062890496
// + https://twitter.com/pennig/status/285790598642946048
// re http://retrogamecrunch.com/tmp/hover
if ('createTouch' in document)
{
try
{
@gabssnake
gabssnake / dabblet.css
Created November 21, 2013 19:28 — forked from LeaVerou/dabblet.css
Switch-style checkboxes.
/**
* Switch-style checkboxes.
* Inspired by Espresso’s “Tools” switch
*/
input[type="checkbox"]:not(:checked),
input[type="checkbox"]:checked { /* :checked here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}
@gabssnake
gabssnake / dabblet.css
Created November 22, 2013 02:01
CSS gradients prefix test
/*
* CSS gradients prefix test
*/
div {
min-height: 10em;
background-color: #ccc;
margin: 0.5em 0;
}
/* Copyright (c) 2011 Aza Raskin
|
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
| documentation files (the "Software"), to deal in the Software without restriction, including
| without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
| copies of the Software, and to permit persons to whom the Software is furnished to do so, subject
| to the following conditions:
|
| The above copyright notice and this permission notice shall be included in all copies or substantial portions
| of the Software.
@gabssnake
gabssnake / Terminal colors and git autocompletion
Created December 6, 2013 09:27
Some colors git autocompletion for .bash_profile
# turn on colors
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxGxGx
# used to get the current git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# add autocompletion for git
@gabssnake
gabssnake / js throttle debounce scroll resize
Last active August 29, 2015 13:56
js throttle debounce scroll resize
// throttle - http://ejohn.org/blog/learning-from-twitter/
// be sure to cache selector
var elem = $(".details"),
scrolled = false;
$(window).on('scroll', function() {
scrolled = true;
});
// $(window).on('resize', function() { resized = true; });
@gabssnake
gabssnake / js element is visible in viewport hittest
Created February 5, 2014 11:08
find out if element is within the viewport, thus visible in that sense
// http://ejohn.org/blog/getboundingclientrect-is-awesome/
// http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport/7557433#7557433
function visible_viewport(el, offset) {
var r, html;
offset = typeof offset !== 'undefined' ? offset : 200;
if ( !el || 1 !== el.nodeType ) { return false; }
html = document.documentElement;
r = el.getBoundingClientRect();
return ( !!r && r.bottom >= offset && r.right >= offset && r.top <= (html.clientHeight+offset) && r.left <= (html.clientWidth+offset) );
/*
* // to set options per instance
* $('#elem').classlider({ message: 'Goodbye World!' });
* // to instantiate with simple Javascript
* var instance = new Classlider(
* document.getElementById('elem'),
* { message: 'Goodbye World!' }
* ).init();