Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
@MelissaKaulfuss
MelissaKaulfuss / installing_ruby_versions_with_chruby.md
Last active August 4, 2023 19:28
How to install different Ruby versions with chruby

Managing Ruby Versions with chruby

So I'm always forgetting how to do this! I guess I'm only ever updating Ruby versions every now and then.

Checking out which Ruby versions chruby has access to

$ chruby will display your installed rubies and show you the version you're currently using in your shell.

   ruby-2.1.2
   ruby-2.2.1
 ruby-2.3.1
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@jakub-g
jakub-g / async-defer-module.md
Last active April 12, 2024 07:32
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

Increase the speed of HTML5 videos

document.getElementsByTagName('video')[0].playbackRate = 2

Works in frontendmasters

## Day 1
9:30AM - Introduction
10:00AM - Pure React
11:00AM - npm, Prettier, ESLint
11:30AM - Parcel
12:00PM - Lunch
1:00PM - JSX
2:00PM - State and Lifecycle Methods with React
3:00PM - Reach Reactor
@bluesmoon
bluesmoon / README.md
Last active September 10, 2019 16:27
This is a loader snippet for boomerang that doesn't use the iframe except for legacy browsers, and does not use document.write

Moved to https://developer.akamai.com/tools/boomerang#mPulseNon-BlockingLoaderSnippet

This is a loader snippet for boomerang (https://github.com/soasta/boomerang) that doesn't use the iframe except for legacy browsers, and does not use document.write

If an iframe is required, it is injected into the page immediately or soon after the script, so you may place the script wherever in the HTML you would like the iframe to show up.

For IE6 & 7, we will fallback to a same-window iframeless dynamic script node. This does mean that the script will be a Single Point of Failure for these two browsers, but given the low combined market share of these two browsers, the choice is between not getting any beacons for these browsers or potentially being a SPoF for users of these browsers.

You MUST include everything, including the `

@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@stevekinney
stevekinney / web-performance.md
Last active January 31, 2024 14:23
Web Performance Workshop

Web Performance

Requirements

Repositories

@ebidel
ebidel / monitor_internet_connection.js
Last active February 28, 2018 18:32
Puppeteer: monitor status of internet connectivity using headless Chrome
Moved to https://github.com/ebidel/puppeteer-examples/blob/master/monitor_internet_connection.js