A Pen by Mithi Sevilla on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <Adafruit_PWMServoDriver.h> | |
int DELAY = 10; | |
int INCREMENT = 1; | |
int FREQ = 150; | |
int LARGE_DELAY = 400; | |
Adafruit_PWMServoDriver pwmTop = Adafruit_PWMServoDriver(0x40); | |
Adafruit_PWMServoDriver pwmBottom = Adafruit_PWMServoDriver(0x41); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <Adafruit_PWMServoDriver.h> | |
// frequency for servo drivers | |
int FREQ = 150; | |
Adafruit_PWMServoDriver pwmTop = Adafruit_PWMServoDriver(0x40); | |
Adafruit_PWMServoDriver pwmBottom = Adafruit_PWMServoDriver(0x41); | |
// Load Wi-Fi library | |
#include <ESP8266WiFi.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> //include Wire.h library | |
void setup() | |
{ | |
Wire.begin(); // Wire communication begin | |
Serial.begin(9600); // The baudrate of Serial monitor is set in 9600 | |
while (!Serial); // Waiting for Serial Monitor | |
Serial.println("\nI2C Scanner"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
0 | 1 | 2 | |
---------- | |
3 | 4 | 5 | |
---------- | |
6 | 7 | 8 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations | |
number_of_items = 8 | |
number_of_draws = 6 | |
iter_sets = combinations([i for i in range(number_of_items)], number_of_draws) | |
sets = list(iter_sets) | |
for s in sets: | |
print(s) | |
len(sets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const radians = thetaDegrees => (thetaDegrees * Math.PI) / 180 | |
const getSinCos = theta => [Math.sin(radians(theta)), Math.cos(radians(theta))] | |
const dot = (a, b) => a.x * b.x + a.y * b.y + a.z * b.z | |
const vectorLength = v => Math.sqrt(dot(v, v)) | |
const vectorFromTo = (a, b) => new Vector(b.x - a.x, b.y - a.y, b.z - a.z) | |
const scaleVector = (v, d) => new Vector(d * v.x, d * v.y, d * v.z) | |
const cross = (a, b) => { | |
const x = a.y * b.z - a.z * b.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'test/unit' | |
include Test::Unit::Assertions | |
# Create values | |
# data: [{id, quantity }, {location_id, quantity }] | |
def test_values | |
data = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'test/unit' | |
include Test::Unit::Assertions | |
# Create values | |
# data: [{id, quantity }, {location_id, quantity }] | |
def test_values | |
data = [] |