Skip to content

Instantly share code, notes, and snippets.

@jiahuang
jiahuang / tags.json
Created October 26, 2011 02:01
How to display a route with the Google Maps API?
["Google Maps","js"]
@jiahuang
jiahuang / example_mapStringify.js
Created April 20, 2012 05:06
javascript trying to stringify map results
/*
Let's say I have this html
<table id="switchesTbl">
<tr>
<td><div class="addButton" type="switch"></div></td>
<td><div class="createLabel">Switch</div></td>
<td><input type="text" class="createInput" value="s1"/></td>
<td><div class="createLabel">Description</div></td>
<td><input type="text" class="createInput" value="d1"/></td>
<td><div class="createLabel">Default</div></td>
@jiahuang
jiahuang / dropStash
Created April 29, 2012 03:47
drop unstaged changes in git
http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git
git stash save --keep-index
git stash drop
@jiahuang
jiahuang / ScrollableGridView.java
Created May 4, 2012 04:20
gridview inside of scrollview
// http://pastebin.com/KMcwGrS8
public class ScrollableGridView extends GridView {
boolean expanded = true;
public ScrollableGridView(Context context)
{
super(context);
}
@jiahuang
jiahuang / .zshrc
Created August 28, 2012 06:31
zsh theme
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="AARON"
# Example aliases
@jiahuang
jiahuang / watchdog.c
Created November 30, 2012 05:55
ATTiny watchdog setting
uint8_t watchdog_count = 0;
ISR(WDT_vect) {
// This vector is for the watchdog timer
PORTA = PORTA | (1 << LED ); // The LED never goes on
++watchdog_count;
}
ISR(PCINT0_vect)
{
var board = require('tessel');
var net = board.net;

console.log('opening tcp socket');

console.log('connecting to', process.env.DEPLOY_IP);
var client = net.connect(3000, process.env.DEPLOY_IP, function () {
  console.log('writing');
 
@jiahuang
jiahuang / cc3k_trace
Created July 30, 2014 07:18
cc3k error trace
→ write HCI_CMND_SOCKET -> request to open socket...
← read HCI_EVNT_SOCKET <- socket #0 opened.
→ write HCI_CMND_SETSOCKOPT 22 bytes: <Buffer 00 00 00 00 ff ff 00 00 02 00 00 00 08 00 00 00 02 ...>
← read HCI_EVNT_SETSOCKOPT 4 bytes: <Buffer 2f 7b 08 00>
→ write HCI_CMND_SETSOCKOPT 24 bytes: <Buffer 00 00 00 00 ff ff 00 00 01 00 00 00 08 00 00 00 04 ...>
← read HCI_EVNT_SETSOCKOPT 4 bytes: <Buffer 00 00 00 00>
→ write HCI_CMND_SOCKET -> request to open socket...
← read HCI_EVNT_SOCKET <- socket #1 opened.
→ write HCI_CMND_SETSOCKOPT 24 bytes: <Buffer 01 00 00 00 ff ff 00 00 00 40 00 00 08 00 00 00 04 ...>
← read HCI_EVNT_SETSOCKOPT 4 bytes: <Buffer ff ff ff ff>
@jiahuang
jiahuang / cc3k_post_log
Created July 30, 2014 07:36
cc3k post log
← read HCI_EVNT_SOCKET <- socket #1 opened.
→ write HCI_CMND_SETSOCKOPT 24 bytes: <Buffer 01 00 00 00 ff ff 00 00 00 40 00 00 08 00 00 00 04 ...>
← read HCI_EVNT_SETSOCKOPT 4 bytes: <Buffer ff ff ff ff>
→ write HCI_CMND_CONNECT -> connecting socket #1... (8.8.8.8)
← read HCI_EVNT_CONNECT 4 bytes: <Buffer 00 00 00 00>
→ write DATA 46 'bytes:' <Buffer 01 00 00 00 0c 00 00 00 1d 00 00 00 00 00 00 00 df ...>
← read HCI_EVNT_SEND 8 bytes: <Buffer 01 00 00 00 1d 00 00 00>
→ write HCI_CMND_SELECT → r .1.. w .... e .1.. [non-blocking, timeout: 3750ms]
← read HCI_EVNT_SELECT ← r .1.. w .... e .... [status 1]
→ write HCI_CMND_RECVFROM 12 bytes: <Buffer 01 00 00 00 01 10 00 00 00 00 00 00>
/* global console */
/* global require */
var tessel = require('tessel');
var http = require('http');
var mainLoop = function() {
var options = {
hostname: '192.168.1.106',
port: 3000,