Skip to content

Instantly share code, notes, and snippets.

View Ynote's full-sized avatar
🌻

Fanny Cheung Ynote

🌻
View GitHub Profile
@srdjan
srdjan / 100+ different counter apps...
Last active May 6, 2024 05:13
100+ different js counter apps...
100+ different js counter apps...
@addyosmani
addyosmani / notes.md
Last active August 10, 2022 03:59
Notes on streaming JS & long-term code compilation caching in Chrome

Re: http://blog.chromium.org/2015/03/new-javascript-techniques-for-rapid.html

V8 Optimisations to enable fast page startup

As mentioned in our Chromium blog post, Chrome 41 introduces support for streaming parsing of JavaScript files using the async or defer attributes. This is where the V8 parser will parse any incoming JavaScript piece-by-piece so the compiler can immediately begin compiling the AST when script loading has completed. This lets us do something useful while waiting for the page to load. Compare:

This means parsing can be removed from the critical path when loading up the page. In these cases such scripts are parsed on a separate thread as soon as the download begins, allowing parsing to complete very soon after the download has completed (milliseconds), leading to pages (potentially) loading much faster.

@ghinda
ghinda / object-to-form-data.js
Last active May 17, 2024 10:48
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 1, 2023 04:55
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch