Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
kevinSuttle / meta-tags.md
Last active April 2, 2025 10:16 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@uupaa
uupaa / image.onload.error.md
Last active September 28, 2022 09:49
image.onload.error

「ブラウザで画像を先読みしたい、簡単な方法はないか?」と聞かれたら、
(new Image()).src = URL; がお勧めです。

この一行で、ブラウザに画像をキャッシュさせる事ができます。

ただ、ブラウザに任せっきりではなく、細かくハンドリングしたい場合もあります。
このエントリはそのような場合に、どういった情報が利用できるかのメモです。

テストコード

@jo
jo / js-crypto-libraries.md
Last active January 16, 2025 12:08
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@davidhund
davidhund / pragmatic-touch-icons.md
Last active February 10, 2025 17:40
Pragmatic Touch Icons

NOTE I'm trying to find the most optimal fav/touch icon setup for my use-cases. Nothing new here. Read Mathias Bynens' articles on re-shortcut-icon and touch icons, a FAQ or a Cheat Sheet for all the details.

I'd like to hear how you approach this: @valuedstandards or comment on this gist.

The issue

You have to include a boatload of link elements pointing to many different images to provide (mobile) devices with a 'favicon' or 'touch icon':

![Touch Icon Links](https://o.twimg.com/2/proxy.jpg?t=HBj6AWh0dHBzOi8vcGhvdG9zLTYuZHJvcGJveC5jb20vdC8yL0FBRGFGY1VRN1dfSExnT3cwR1VhUmtaUWRFcWhxSDVGRjNMdXFfbHRJWG1GNFEvMTIvMjI3OTE2L3BuZy8xMDI0eDc2OC8yL18vMC80L1NjcmVlbnNob3QlMjAyMDE1LTA0LTE0JTIwMTYuNTYuMjYucG5nL0NNejBEU0FCSUFJZ0F5Z0JLQUkvNGR1eDZnMzZmYnlzYWI3

@wilsonpage
wilsonpage / storage.js
Created September 11, 2015 14:25
Simple localStorage like wrapper around indexeddb
function Storage(name) {
this.ready = new Promise((resolve, reject) => {
var request = window.indexedDB.open(location.origin);
request.onupgradeneeded = e => {
this.db = e.target.result;
this.db.createObjectStore('store');
};
request.onsuccess = e => {
@RafalSladek
RafalSladek / .gitlab-ci.yml
Last active February 26, 2025 15:02
gitlab ci file for gulp build pipeline with the latest nodejs
image: node:latest
cache:
paths:
- node_modules/
before_script:
- npm install
stages:
<script type="text/javascript">
// This is a modified version of the script Davin Studer from
// http://iamdav.in/2014/10/24/bookmarklet-creating-csv-html-table/
// I added in a BOM mark to allow for non-english table contents export as well as
// wrapped it in a script snippet to be appended at them end of a confluence page in a html block
function downloadCSVFile(filename, mime, text) {
if (window.navigator.msSaveOrOpenBlob){
// IE 10+
var blob = new Blob([decodeURIComponent(encodeURI(text))], {
type: 'text/csv;charset=utf-8'
@rhostem
rhostem / _document.js
Last active January 2, 2022 07:40
[react, next.js] tags in head for SEO
import Head from 'next/head'
import SEO from '../constants/seo'
export default ({
title = SEO.title,
description = SEO.description,
pageUrl = SEO.siteUrl,
mainImage = SEO.mainImage,
iosApplink = SEO.quizBuzzHomeUrl,
androidAppLink = SEO.quizBuzzHomeUrl,
@simov
simov / README.md
Last active October 8, 2024 11:55
Run `node` scripts using `nvm` and `crontab` without hardcoding the node version

Run node scripts using nvm and crontab without hardcoding the node version

cronjob.env.sh

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
//https://habr.com/post/213515/
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction,
baseName = "baseName",
storeName = "storeName";
function logerr(err){
console.log(err);