Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Huy Tr. huytd

💭
I may be slow to respond.
Block or report user

Report or block huytd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huytd
huytd / timeCounter.ino
Created Oct 19, 2014
Simple time counter (90s)
View timeCounter.ino
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
int LED_PIN = 8;
int INP = 2;
int counter = 0;
@huytd
huytd / tyrion.go
Last active Aug 29, 2015
Tyrion Lannister in Go
View tyrion.go
package main
import "fmt"
type Lannister struct{}
func (l *Lannister) Roar() {
fmt.Println("Hear me roar!!!")
}
@huytd
huytd / tyrion-external.go
Created Jul 4, 2015
Tyrion Lannister in external Go file. Main package.
View tyrion-external.go
package main
import "fmt"
type Lannister struct{}
func (l *Lannister) Roar() {
fmt.Println("Hear me roar!!!")
}
@huytd
huytd / tyrion-main.go
Created Jul 4, 2015
Tyrion Lannister in Go. Main file.
View tyrion-main.go
package main
func main() {
var tyrion = Lannister{}
tyrion.Roar()
}
@huytd
huytd / project.struct
Created Jul 4, 2015
Project structure
View project.struct
project
|_ app
| |_ Lannister.go
|_ main.go
@huytd
huytd / Lannister.go
Last active Aug 29, 2015
Lannister external package in Go
View Lannister.go
package app
import "fmt"
type Lannister struct{}
func (l *Lannister) Roar() {
fmt.Println("Hear me roar!!!")
}
@huytd
huytd / d3_realtime_linechart.html
Created Nov 6, 2015
Realtime Line Chart with D3
View d3_realtime_linechart.html
<style>
.axis {
font-family: sans-serif;
fill: #d35400;
font-size: 12px;
}
.line {
fill: none;
View index.html
<link href='http://fonts.googleapis.com/css?family=Open+Sans:700' rel='stylesheet' type='text/css'>
<a id="view-code" href="http://codepen.io/virgilpana/pen/wBOBYo" target="_blank">VIEW CODE</a>
<div id="window">
<div id="header">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
@huytd
huytd / d3-text-measure.js
Created May 6, 2016
Measure text size in pixels with D3.js
View d3-text-measure.js
function textSize(text) {
if (!d3) return;
var container = d3.select('body').append('svg');
container.append('text').attr({ x: -99999, y: -99999 }).text(text);
var size = container.node().getBBox();
container.remove();
return { width: size.width, height: size.height };
}
// Usage: textSize("This is a very long text");
You can’t perform that action at this time.