Skip to content

Instantly share code, notes, and snippets.

View johhansantana's full-sized avatar

Johhan Santana johhansantana

View GitHub Profile
@johhansantana
johhansantana / script.js
Created December 8, 2015 19:33
smoothscroll to anchor
// smoothscroll anchor function
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top - 50
}, 1000);
@johhansantana
johhansantana / index.html
Created December 2, 2015 13:50
auto height youtube iframe videos
<!-- source: https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php -->
<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>
<style>
.videoWrapper {
position: relative;
@johhansantana
johhansantana / style.css
Created November 24, 2015 16:29
Transparent background image
footer {
min-height: 300px;
background-color: #013378;
color: white;
padding-top: 30px;
position: relative;
}
footer::after {
content: "";
@johhansantana
johhansantana / style.css
Created November 24, 2015 16:27
Multiple background images css
.multi_bg_example {
background-image : url(https://mdn.mozillademos.org/files/11305/firefox.png),
url(https://mdn.mozillademos.org/files/11307/bubbles.png),
linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0));
background-repeat : no-repeat,
no-repeat,
no-repeat;
background-position: bottom right,
@johhansantana
johhansantana / scrolltotop.js
Created November 19, 2015 20:01
scroll to top ui-router angular
$rootScope.$on('$stateChangeSuccess',function(){
$("html, body").animate({ scrollTop: 0 }, 200);
});
@johhansantana
johhansantana / gruntfile.js
Created November 18, 2015 00:27
gruntfile.js
// Generated on 2015-11-18 using generator-angular 0.14.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
@johhansantana
johhansantana / gist:02326abd5a31a7f15faa
Created November 17, 2015 23:29
list npm packages versions that are online
npm view generator-meanjs versions
@johhansantana
johhansantana / script.js
Created November 9, 2015 19:57
bootstrap popover body overlay
$('[data-toggle="popover"]').on('mouseenter', function(){
$('.overlay-light').finish().fadeOut();
$('.overlay-light').fadeIn();
});
$('[data-toggle="popover"]').on('mouseleave', function(){
$('.overlay-light').finish().fadeIn();
$('.overlay-light').fadeOut();
});
@johhansantana
johhansantana / style.css
Created November 5, 2015 18:14
select first class with css
.myclass {
/* styles of the first one */
}
.myclass ~ .myclass {
/* styles of the others (must cancel the styles of the first rule) */
}
/* source: http://stackoverflow.com/questions/5287272/css-select-first-element-with-a-certain-class */
@johhansantana
johhansantana / jquery-validate.js
Created October 31, 2015 17:09
jquery validate syntax
$('#contact_form').validate({
debug: true,
rules: {
name: "required", // should be: "user[username]"
email: { // should be: "user[email]"
required: true,
email: true
}
},
messages: {