Skip to content

Instantly share code, notes, and snippets.

View azurite's full-sized avatar
:octocat:
Napping

Marko Nikic azurite

:octocat:
Napping
  • ETH Zürich
  • Switzerland
View GitHub Profile
@lencioni
lencioni / AsyncComponent.jsx
Created January 8, 2017 17:09
<AsyncComponent> at Airbnb used for Webpack code splitting
// Usage:
//
// function loader() {
// return new Promise((resolve) => {
// if (process.env.LAZY_LOAD) {
// require.ensure([], (require) => {
// resolve(require('./SomeComponent').default);
// });
// }
// });
@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active April 18, 2024 07:58
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015;

Last update on December 14, 2023

Updated on February 27, 2023

Updated August 29, 2019.

@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**
@zhangsen
zhangsen / 0-1-knapsack.py
Created June 17, 2012 02:37
0-1 knapsack with exact total weight and minimal total value
# http://programmers.stackexchange.com/questions/117136/converting-a-bounded-knapsack-problem-to-0-1-knapsack-problem
# weight: cable length
# total weight: target span
# value: 1 for each cable
# want minimum number of cables, i.e. minimum total value
def knapsack_01_exact_min(weights, values, W):
# 0-1 knapsack, exact total weight W, minimizing total value
n = len(weights)