Skip to content

Instantly share code, notes, and snippets.

@huytd
huytd / tyrion-main.go
Created July 4, 2015 18:25
Tyrion Lannister in Go. Main file.
package main
func main() {
var tyrion = Lannister{}
tyrion.Roar()
}
@huytd
huytd / project.struct
Created July 4, 2015 18:33
Project structure
project
|_ app
| |_ Lannister.go
|_ main.go
@huytd
huytd / Lannister.go
Last active August 29, 2015 14:24
Lannister external package in Go
package app
import "fmt"
type Lannister struct{}
func (l *Lannister) Roar() {
fmt.Println("Hear me roar!!!")
}
@huytd
huytd / JSONRequest.cs
Last active December 28, 2015 18:49
JSON Request class in C#
using System;
using System.Net;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Gamarist
{
public class JSON : Dictionary<string, string> { }
<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 / co-in-15-lines.js
Last active May 25, 2016 10:10
Re-implement tj/co in 15 lines
function run(fn) {
var pointer = fn();
var next = function(result) {
if (result.value.then && typeof result.value.then === 'function') {
result.value.then(function(data) {
var out = pointer.next(data);
if (!out.done) next(out);
});
} else {
var out = pointer.next(result.value);
@huytd
huytd / workWithJson.go
Created June 22, 2016 20:19
Working with JSON in Golang
package main
import (
"fmt"
"encoding/json"
)
type (
Map map[string]interface{}
)
@huytd
huytd / goASTParsing.go
Created June 26, 2016 20:07
Parse code using AST
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func main() {
@huytd
huytd / lldb_cheat_sheet.md
Created July 14, 2016 17:48 — forked from ryanchang/lldb_cheat_sheet.md
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type