I hereby claim:
- I am christophevg on github.
- I am christophevg (https://keybase.io/christophevg) on keybase.
- I have a public key ASAchSq6OMeHwqCkToGzHbZq1CQFLsNJDZxCg0p1hGMFhgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Courtesy http://www.instructables.com/id/How-to-Use-an-RGB-LED/?ALLSTEPS | |
// function to convert a color to its Red, Green, and Blue components. | |
void hueToRGB(uint8_t hue, uint8_t brightness, bool invert) { | |
uint16_t scaledHue = (hue * 6); | |
uint8_t segment = scaledHue / 256; // segment 0 to 5 around the | |
// color wheel | |
uint16_t segmentOffset = | |
scaledHue - (segment * 256); // position within the segment |
This Gist is a combination a many different solutions found around the net. It shows how to create two TreeViews and visually connect two nodes in each of them.
Most "problems" are covered:
I hereby claim:
To claim this, I am signing this object:
#include <stdio.h> // for printf | |
#define START 123 // initial number to use to start sequence | |
#define MAX 5 // maximum number of items in the list | |
int main(void) { | |
// create list on the stack | |
int lst[MAX]; | |
// fill list |
# Illustration of Python generators | |
def count_down(size): | |
print "starting generation" | |
while size > 1: | |
print "yielding" | |
yield size | |
size -= 1 | |
print "finishing generation" | |
yield size |
// Part 1. | |
// Implement a function prototype extension that caches function results for | |
// the same input arguments of a function with one parameter. | |
// | |
// For example: | |
// Make sin(1) have the result of Math.sin(1), but use a cached value | |
// for future calls. | |
Function.prototype.withCaching = function withCaching() { | |
if( ! this.cache ) { this.cache = {}; } // lazy initialization of cache |