Skip to content

Instantly share code, notes, and snippets.

View allusis's full-sized avatar
👊

Tony Montemorano allusis

👊
View GitHub Profile
@allusis
allusis / 1-sample-template.page
Last active November 30, 2016 22:20
Visualforce page template page and insert page
<apex:page docType="html-5.0" showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false" >
<html dir="ltr" lang="en-US" >
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<!-- vfsass is the name of our static resource, replace this with your own file -->
<apex:stylesheet value="{!URLFOR($Resource.vfsass, 'css/main.css')}"/>
</head>
@allusis
allusis / highlight-anchor.js
Created December 12, 2015 18:20
Add a highlight to an anchor when it's linked
$(document).ready(function(){
$('a[href*="#"]').click(function(){
$($(this).attr("href")).addClass("highlight").delay(10000).queue(function(next){
$(this).removeClass('highlight');
next();
});
});
});
@allusis
allusis / copyright.js
Created December 12, 2015 18:23
Make the copyright year that you hate updating dynamic
@allusis
allusis / scroll-class.js
Created December 12, 2015 18:27
Add CSS class on scroll
$(function(){
var shrinkHeader = 10;
$(window).scroll(function() {
var scroll = getCurrentScroll();
if ( scroll >= shrinkHeader ) {
$('body').addClass('scrolled');
}
else {
$('body').removeClass('scrolled');
}
@allusis
allusis / footer.scss
Created December 12, 2015 18:30
A sticky footer that pays little or no regard to markup
@allusis
allusis / _drop-shadow.scss
Last active December 12, 2015 18:34
A SCSS Mixin for drop-shadow
@mixin drop-shadow($dropshadow) {
-webkit-filter:drop-shadow($dropshadow);
-moz-filter:drop-shadow($dropshadow);
-ms-filter:drop-shadow($dropshadow);
filter:drop-shadow($dropshadow);
}
// Example usage
.box {
@include drop-shadow(0 0 5px black);
@allusis
allusis / _material-shadow.scss
Last active December 17, 2015 06:09
Material shadow mixin
// Material-like shadowing
@mixin shadow($level: 1) {
@if $level == 1 {box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);}
@else if $level == 2 {box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);}
@else if $level == 3 {box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);}
@else if $level == 4 {box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);}
@else if $level == 5 {box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);}
}
// Example usage
@allusis
allusis / _color-contrast.scss
Last active December 17, 2015 06:09
A Sass function for determine contrasting colors
$text-color: #555;
@function contrast-color($color) {
@if (lightness($color) > 75) {
// Lighter background, return dark color
@return $text-color;
} @else {
// Darker background, return light color
@return white;
}
@allusis
allusis / collapse-toggle.js
Last active December 17, 2015 06:08
Expand / Collapse text toggling for Bootstrap3
$(function () {
var active = true;
$('#expand-btn').click(function() {
if (active) {
active = false;
$('.collapse:not(.in)').collapse('show');
$('.panel-header').attr('data-toggle', 'collapse');
$(this).text('Collapse all sections');
} else {
active = true;
@allusis
allusis / inline-svg.js
Last active December 17, 2015 06:08
Replace <img> with svg file source
$(document).ready(function () {
// Replace img tag with svg src
jQuery('.img-inline').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
jQuery.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = jQuery(data).find('svg');