Skip to content

Instantly share code, notes, and snippets.

@milahu
milahu / index.html
Last active Oct 5, 2020
performance of different loop types #jsbench #jsperf (http://jsbench.github.io/#6f65c587af9277325bcda0e69ba44d5f) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>performance of different loop types #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jaames
jaames / fancy-css-links.md
Last active Dec 29, 2021
Fancy CSS link underlines with inline SVGs (plus embedded animations!)
View fancy-css-links.md
@timw4mail
timw4mail / json-parser.js
Last active Jan 19, 2021
Pure JS JSON Parser
View json-parser.js
/**
* Pure JS JSON Parser
*
* @see https://lihautan.com/json-parser-with-javascript/
* @param {string} str
*/
function parseJSON(str) {
let i = 0;
const value = parseValue();
@edro15
edro15 / CompileNetBeansProjectANT.md
Created Nov 19, 2019
[How To] Compile a Java NetBeans project with Apache Ant
View CompileNetBeansProjectANT.md

Problem

You need to modify code of a Java NetBeans project but you neither have or want to install that IDE in order to re-compile it.

Solution

Use Apache Ant to compile your Java code.

Instructions

  • Create a folder (e.g. lib) in your project, at the same level of nbproject, and save all dependencies (jars) there.
@boukeversteegh
boukeversteegh / sortArrays.js
Last active Jul 2, 2021
Sorting multiple arrays in Javascript
View sortArrays.js
/**
* Sorts all arrays together with the first. Pass either a list of arrays, or a map. Any key is accepted.
* Array|Object arrays [sortableArray, ...otherArrays]; {sortableArray: [], secondaryArray: [], ...}
* Function comparator(?,?) -> int optional compareFunction, compatible with Array.sort(compareFunction)
*/
function sortArrays(arrays, comparator = (a, b) => (a < b) ? -1 : (a > b) ? 1 : 0) {
let arrayKeys = Object.keys(arrays);
let sortableArray = Object.values(arrays)[0];
let indexes = Object.keys(sortableArray);
let sortedIndexes = indexes.sort((a, b) => comparator(sortableArray[a], sortableArray[b]));
@JerryLokjianming
JerryLokjianming / Crack Sublime Text Windows and Linux.md
Last active Jan 17, 2022
Crack Sublime Text 3.2.2 Build 3211 and Sublime Text 4 Alpha 4098 with Hex
View Crack Sublime Text Windows and Linux.md

YouTube Channel https://www.youtube.com/c/jerrylokjianming


How to Crack Sublime Text 3.2.2 Build 3211 with Hex Editor (Windows | Without License) ↓

  1. Download & Install Sublime Text 3.2.2 Build 3211
  2. Visit https://hexed.it/
@cheesits456
cheesits456 / uneval.js
Last active Jan 12, 2020 — forked from cho45/uneval.js
Stringify multiple JS Object Types
View uneval.js
function uneval(o) {
switch (typeof o) {
case "undefined": return "(void 0)";
case "boolean": return String(o);
case "number": return String(o);
case "string": return `"${o.replace(/\W/gi, function(_) { return `\\u${(0x10000 + _.charCodeAt(0)).toString(16).slice(1)}` })}"`;
case "function": return `(${o.toString()})`;
case "object":
if (o == null) return "null";
let ret, type = Object.prototype.toString.call(o).match(/\[object (.+)\]/);
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active Jan 9, 2022
The truth about Svelte
View what-is-svelte.md

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@WesThorburn
WesThorburn / 1.Instructions.md
Last active Dec 26, 2021
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake
View 1.Instructions.md

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Checkout main: git checkout main
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
@gbaman
gbaman / graphql_example.py
Created Nov 1, 2017
An example on using the Github GraphQL API with Python 3
View graphql_example.py
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200: