Skip to content

Instantly share code, notes, and snippets.

@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active March 13, 2025 06:49
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@johnmcase
johnmcase / updateNpm.bat
Last active October 6, 2022 16:28
Update npm on windows
rem see https://github.com/coreybutler/nvm-windows/issues/300
@echo off
SETLOCAL EnableDelayedExpansion
if [%1] == [] (
echo Pass in the version you would like to install, or "latest" to install the latest npm version.
) else (
set wanted_version=%1
//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);
@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
@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,
<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'
@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:
@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 => {
@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

@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.