Skip to content

Instantly share code, notes, and snippets.

@CosAnca
CosAnca / head.html
Created February 3, 2021 16:29 — forked from krschmidt/head.html
Set Canonical URL via Javascript
<script type='text/javascript'>
var link = !!document.querySelector("link[rel='canonical']") ? document.querySelector("link[rel='canonical']") : document.createElement('link');
link.setAttribute('rel', 'canonical');
link.setAttribute('href', location.protocol + '//' + location.host + location.pathname);
document.head.appendChild(link);
</script>
@CosAnca
CosAnca / easing.css
Created April 26, 2020 14:24 — forked from bendc/easing.css
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
@CosAnca
CosAnca / HtmlHelperExtensions.cs
Created November 26, 2019 17:55 — forked from mariusschulz/HtmlHelperExtensions.cs
Two C# extension methods for inlining script and style bundles into the HTML response using ASP.NET MVC and the System.Web.Optimization framework.
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
public static class HtmlHelperExtensions
{
public static IHtmlString InlineScripts(this HtmlHelper htmlHelper, string bundleVirtualPath)
{
return htmlHelper.InlineBundle(bundleVirtualPath, htmlTagName: "script");
@CosAnca
CosAnca / gatsby-config.js
Created November 21, 2019 20:23 — forked from horacioh/gatsby-config.js
Gatsby config: PostCSS, Tailwind, Emotion, Prismic, Google Analytics, Manifest & Offline
/* eslint-disable jsx-a11y/rule-name */
const path = require("path")
require("dotenv").config({
path: `../.env.${process.env.NODE_ENV}`,
})
module.exports = {
siteMetadata: {
@CosAnca
CosAnca / app.js
Created October 21, 2019 16:21 — forked from earthlingdavey/app.js
example of making flickity slider more adaptive.
$sliderElement = $('.variation-slider');
var sliderOptions = {
cellSelector: '.variation-slide',
freeScroll: true,
pageDots: false,
imagesLoaded: true,
percentPosition: false,
wrapAround: true
};
@CosAnca
CosAnca / package.json
Created October 19, 2019 09:55 — forked from SigurdMW/package.json
Webpack config for Epi Server. Handles .scss, .css, .js, font-files, images (in .js/.scss/.css). Autoprefix and minifying is included
{
"name": "skuld-frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "backstop test",
"approve-tests": "backstop approve",
"build": "set NODE_ENV=production && webpack -p",
"watch": "webpack --cache=false --watch"
import React from 'react';
type Props = {
data: Array<[number, string]>;
};
export default function LineChart({ data }: Props) {
if (!data.length) {
return null;
}
@CosAnca
CosAnca / gatsby-config.js
Created September 26, 2019 09:51 — forked from monachilada/gatsby-config.js
Sample gatsby-config.js enabling live preview in Craft CMS
const { createHttpLink } = require('apollo-link-http');
const fetch = require('node-fetch');
const store = require('store');
const sourceNodes = require('gatsby/dist/utils/source-nodes');
require('dotenv').config();
const craftGqlUrl = process.env.CRAFT_GQL_URL;
const craftGqlToken = process.env.CRAFT_GQL_TOKEN;
module.exports = {
@CosAnca
CosAnca / log-tab-focus.js
Created May 24, 2019 21:50 — forked from ryanve/log-tab-focus.js
Log :focus element each time tab key is pressed
document.addEventListener('keyup', function(e) {
9 != e.keyCode || e.metaKey || e.ctrlKey || console.log(document.activeElement)
}, false)
@CosAnca
CosAnca / default-wordpress-blocks-sass.scss
Created January 22, 2019 20:29 — forked from davewarfel/default-wordpress-blocks-sass.scss
WordPress Blocks Styles - Cleaned Up, Commented & Sassified
/**
* WordPress Blocks
*
* Provides a better starting point for WordPress theme developers,
* especially if you're using Sass.
*/
/**
* 1.0 - Paragraph
* 3.0 - Blockquote