On some mobile platforms there are alphabetical lists that use the letter as a title. As you scroll down the list the title follows you until you get to the next one. This snippet emulates this functionality.
A Pen by Chris Spittles on CodePen.
| var w,h,partcounter; | |
| var canvas, ctx; | |
| var mousex, mousey; | |
| function map(value, low1, high1, low2, high2) { | |
| return low2 + (high2 - low2) * (value - low1) / (high1 - low1); | |
| } | |
| function vec(x_, y_){ | |
| this.x = x_; |
| ArrayList<String> letters; | |
| ArrayList<String> combo; | |
| int n=6; | |
| int k=n; | |
| void go(int offset, int k) { | |
| if (k==0) { | |
| println(combo); | |
| return; | |
| } |
| color[] colorPalette = new color[] { | |
| color(0, 0, 0), | |
| color(0, 0, 255), | |
| color(0, 255, 0), | |
| color(0, 255, 255), | |
| color(255, 0, 0), | |
| color(255, 0, 255), | |
| color(255, 255, 0), | |
| color(255, 255, 255) | |
| }; |
On some mobile platforms there are alphabetical lists that use the letter as a title. As you scroll down the list the title follows you until you get to the next one. This snippet emulates this functionality.
A Pen by Chris Spittles on CodePen.
| <div class="items a"> | |
| <h3>A</h3> | |
| <p>a first thing</p> | |
| <p>another thing</p> | |
| <p>another thing</p> | |
| <p>another thing</p> | |
| <p>another thing</p> | |
| </div> | |
| <div class="items b"> | |
| <p>banother thing</p> |
| <canvas></canvas> | |
| <script src='script.js'></script> |
| import requests | |
| from bs4 import BeautifulSoup | |
| def get_data(url): | |
| page = requests.get(url) | |
| soup = BeautifulSoup(page.content) | |
| return soup |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| def generate_time_series(batch_size, n_steps): | |
| f1, f2, off1, off2 = np.random.rand(4) | |
| n = 0 | |
| noise = 0.1 * (np.random.rand(batch_size * n_steps) - 0.5) | |
| time = np.linspace(0, 1, n_steps) | |
| while n < batch_size: | |
| series = 0.5 * np.sin((time - off1) * (f1 * 10 + 10)) |
| /* Matrix Functions | |
| * | |
| * These function operate on vanilla 1D or 2D arrays. | |
| * This could be extended to a matrix class which might | |
| * allow for a better API as chaining operations in this | |
| * form gets pretty ugly and unmanageable pretty quickly. | |
| */ | |
| export function matmul(a, b) { | |
| /* Matrix Multiplication */ |