Skip to content

Instantly share code, notes, and snippets.

@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active May 2, 2024 03:11
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@flavioespinoza
flavioespinoza / depth_chart.html
Last active April 21, 2023 14:00
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<style>
@crestonbunch
crestonbunch / mlstm.py
Last active May 12, 2018 00:11
Multiplicative LSTM (mLSTM) Wrapper for Tensorflow
"""A multiplicative cell wrapper as described in
'Multiplicative LSTM for Sequence Modeling' by Krause et al."""
import tensorflow as tf
import math
from collections import namedtuple
from tensorflow.contrib.rnn import RNNCell
from tensorflow.python.ops.rnn_cell_impl import LSTMStateTuple
class MultiplicativeLSTMWrapper(RNNCell):
@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 &amp;&amp; chmod +x minikube &amp;&amp; sudo mv minikube /usr/local/bin/
@idibidiart
idibidiart / graphql-relay-miracle-cure.md
Last active February 21, 2016 22:06
UI Blues Got You Down? Try GraphQL/Relay Miracle Cure! :D
@veltman
veltman / README.md
Last active September 14, 2021 10:28
Gif rendering - SVG to GIF

Testing in-browser gif generation from an SVG with gif.js. Works in recent Chrome/Safari/Firefox.

Process:

  1. Create a standard SVG line chart.
  2. Step through in-between frames of the line chart: for each one, update the SVG, render to an image, add the image element to a stack of gif frames.
  3. Render frames together in the background using gif.js web workers.
  4. When rendering's complete, add the blob URL as an image and start the SVG on an infinite loop with d3.timer (gratuitous).

See also: Gif Globe, Gif New Jersey

@scottoffen
scottoffen / clipboard-example.html
Last active April 13, 2022 08:38
JavaScript Copy To Clipboard Example
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Copy To Clipboard Example</title>
</head>
<body>
<input id="txtToCopy" type="text">
<button id="btnCopy">Copy!</button>
// Simplest possible wrapper around IHKeyboardAvoiding.
//
// I don't really know how to Xcode, but I got it to work by:
//
// 1. Checking out the IHKeyboardAvoiding repository.
// https://github.com/IdleHandsApps/IHKeyboardAvoiding
//
// 2. Dragging the Files IHKeyboardAvoiding.{h,m} into my project.
//
// 3. Ensuring that both .m files are in the "Compile Sources" phase of the target.
@ide
ide / index.ios.js
Last active September 1, 2015 00:39
Redux batching example with React Native
/**
* Batched updates test with Redux. You will need React 0.6.0 and a .babelrc:
{
"whitelist": [
"es6.parameters.default",
"es7.decorators"
]
}
*/
'use strict';