Skip to content

Instantly share code, notes, and snippets.

View origamid's full-sized avatar

André origamid

View GitHub Profile
@origamid
origamid / html2img.html
Created March 27, 2020 17:36
html 2 canvas 2 image download
<div class="capture" contenteditable>
<p>Capture with right click</p>
</div>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<script>
const elementToSave = document.querySelector(".capture");
// Download with right click
document.addEventListener("contextmenu", () => {
html2canvas(elementToSave).then(canvas => {
@origamid
origamid / smooth-scroll.js
Last active July 21, 2022 15:23 — forked from clemlatz/smooth-scroll.js
Smooth Scroll Animation - JavaScript
/**
* Smooth scroll animation
* @param {int} endX: destination x coordinate
* @param {int} endY: destination y coordinate
* @param {int} duration: animation duration in ms
*/
function smoothScrollTo(endX, endY, duration) {
const startX = window.scrollX || window.pageXOffset;
const startY = window.scrollY || window.pageYOffset;
const distanceX = endX - startX;
@origamid
origamid / expose
Created October 17, 2014 18:34
expose-animation
defaults write com.apple.dock expose-animation-duration -float 0.1 ; killall Dock
defaults delete com.apple.dock expose-animation-duration ; killall Dock
@origamid
origamid / delete_ds_store
Last active August 29, 2015 14:04
Delete .ds_store from directory and subdirectory
find . -name '*.DS_Store' -type f -delete
@origamid
origamid / sameheight
Created June 22, 2014 00:43
Same Height
$(document).ready(function(){
$('.servicos__item').each(function(){
var highestBox = 0;
$('.servicos__item__coluna', this).each(function(){
if($(this).height() > highestBox)
highestBox = $(this).height();
});
$('.servicos__item__info',this).height(highestBox);
});
});
@origamid
origamid / headerfixo.js
Created March 13, 2014 21:34
Header Fixo Animado
$(document).scroll(function() {
if( $(this).scrollTop() > 100 ) {
$(".header-fixed").addClass("header-small");
} else if( $(this).scrollTop() < 100 ) {
$(".header-fixed").removeClass("header-small");
}
});
@origamid
origamid / galeriafotos.js
Created March 13, 2014 21:34
Galeria de Fotos
$(function() {
$(".projetos__lista-img > li:first-child > a").addClass("active");
$(".projetos__lista-img > li > a").hover(function(e) {
$(this).parent().parent().find("li > a").removeClass("active");
e.preventDefault();
$(this).addClass("active");
var linkImagem = $(this).attr("href");
var $imagemFinal = $(this).parent().parent().parent().parent();
$($imagemFinal).find(".projetos__img img").attr("src",linkImagem);
});
@origamid
origamid / itemtoggle.js
Created March 13, 2014 21:32
Item Toggle
$(function() {
$('dd').hide();
$('dt').each(function() {
$(this).show(0).on('click', function(e) {
e.preventDefault();
$(this).toggleClass('active');
$(this).next('dd').slideToggle();
});
});
});
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@origamid
origamid / gist:7354181
Last active December 27, 2015 16:19
JS: Waypoint
$(document).ready(function() {
$('.main__ideal').waypoint(function() {
$('.main__ideal ul li').each(function(d){
$(this).delay(d * 150).fadeTo('slow', 1);
});
},
{
offset: '80%'
});