Skip to content

Instantly share code, notes, and snippets.

View endymion1818's full-sized avatar
🦈
47

Ben Read endymion1818

🦈
47
View GitHub Profile
@endymion1818
endymion1818 / backToTop
Created November 18, 2015 12:28
JavaScript for a back To Top button scrolling nicely
$('.backtotop').click(function () {
$("html, body").animate({
scrollTop: 0
}, 600);
return false;
});; $(document).scroll(function(){
$('.navbar').toggleClass('scrolled', $(this).scrollTop() > 1);
$('.backtotop').toggleClass('scrolled', $(this).scrollTop() > 1);
});
@endymion1818
endymion1818 / anim.scss
Created February 16, 2016 13:48
Animation with a delay between states (sort of)
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
transform: translateY(20px);
}
10% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0);
@endymion1818
endymion1818 / animationOnPageOut.js
Created March 22, 2016 17:12
This JS adds a delay of 500ms when a user clicks any <a> tag on the page, so that you can fire an animation class
window.onload = function(){
var links = document.getElementsByTagName('a');
for( var i=0,il = links.length; i< il; i ++ ){
links[i].onclick = clickHandler;
}
function clickHandler(event) {
@endymion1818
endymion1818 / git config aliases
Last active October 18, 2023 15:00
Just in case my computer blows up, I have all of my git shortcuts here
[push]
autoSetupRemote = true
[user]
name = xxx
email = xxx
[core]
excludesfile = ~/.gitignore
[alias]
sla = log --oneline --decorate --graph --all
whowhen = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@endymion1818
endymion1818 / cdnornot.js
Created September 21, 2016 09:05
If the devide cuts the mustard, add some custard! Write from CDN, or local if that fails (after 1s)
<script type="text/javascript">
// Mustard Cutting
if ('querySelector' in document && 'addEventListener' in window) {
var windowWidth = document.body.clientWidth;
if(windowWidth > 768){
// add class to HTML tag
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);
// load scripts - from cdn but with a fallback
@endymion1818
endymion1818 / mustardcustard.js
Last active September 5, 2017 09:10
timeout add custard - write these files to the document if conditions for extra custard are met
// Mustard Cutting
if ('querySelector' in document && 'addEventListener' in window) {
// add class to HTML tag
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);
// load critical scripts
document.write(unescape("%3Cscript src='assets/js/whatcananimate-criticalscripts.min.js' type='text/javascript' defer%3E%3C/script%3E"));
// add custard if screen size is big enough
<?php
namespace Origin\Theme\Metaboxes;
class PageMetaBox extends \Origin\Framework\Objects\Metabox
{
/**
* A unique id/key for this Meta box.
*
* @var string
Doc - Complete Fully - - Loaded
Load time First Byte Start Render Speed Index First Interactive Time Requests Bytes In Time Requests Bytes In Cost
@endymion1818
endymion1818 / netmag-context-data
Created January 26, 2019 09:27
Context tutorial data
[
{
"_id": "5c4c278665e65c411445a158",
"index": 0,
"guid": "3d80eb64-3477-408a-997f-eb8fe2e0fb2a",
"isActive": true,
"about": "Et veniam sunt cillum occaecat dolor in ex sunt nulla anim deserunt cupidatat laborum. Consequat commodo laboris officia labore eiusmod enim pariatur deserunt. Qui minim ipsum incididunt pariatur elit ullamco dolore officia sunt sit cillum.",
"highValue": [
"5,763.60",
"2,185.52",
import React, {FC} from 'react'
import Column from '../Atoms/Column'
import Row from '../Atoms/Row'
export interface IContentProps {
/**
* an array of objects with JSX elements
* @default <>&nbsp;</>
*/
innerContent: JSX.Element