Skip to content

Instantly share code, notes, and snippets.

@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@amitasaurus
amitasaurus / dateFilter.js
Created August 16, 2018 13:48
Angular Filter to display minutes/hours to a time
app.filter('dateFilter', function() {
return function(date) {
let oneSec = 1000;
let oneMin = 60 * oneSec;
let oneHour = 60 * oneMin;
let oneDay = 24 * oneHour;
let now = new Date().getTime();
let transactionTime = new Date(date).getTime();
let transactionDate = new Date(date);
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active May 19, 2024 10:45
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
self.addEventListener('fetch', function(event) {
event.respondWith(
// This method looks at the request and
// finds any cached results from any of the
// caches that the Service Worker has created.
caches.match(event.request)
.then(function(response) {
// If a cache is hit, we can return thre response.
if (response) {
return response;
@shivamkr19
shivamkr19 / download-egghead-io-videos.md
Last active February 4, 2022 09:48
Download free egghead.io videos

Download free egghead.io videos

Download Egghead.io videos using Lynx Browser and youtube-dl. This method will only work for videos that do not require a pro account.

Prerequesits

You need a Unix/Linux box with Lynx console browser and Youtube-dl installed.

@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@jhnns
jhnns / index.json
Last active May 26, 2020 03:10
Most popular web repositories with at least 10.000 stars. Compiled in May 2017 with https://github.com/jhnns/popular-javascript-projects. The list of repo types can be found at https://gist.github.com/jhnns/d233e88b40f5a2993c240847ccef4ee3.
[
{
"name": "freeCodeCamp/freeCodeCamp",
"description": "The https://freeCodeCamp.com open source codebase and curriculum. Learn to code and help nonprofits.",
"stars": 266038,
"type": "other"
},
{
"name": "twbs/bootstrap",
"description": "The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.",
@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*