This file contains hidden or 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
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<style> | |
#view { float: right; width: 75vw; height: 98vh; } | |
nav { float: left; width: 20vw; height: 98vh; } | |
#nav { height: 100%; max-height: 90vh; overflow-y: scroll; } | |
.active { font-weight: bold; } | |
</style> | |
<title>Book search</title> | |
<iframe name=bob id=view src=blank.html></iframe> | |
<nav> |
This file contains hidden or 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
enum ID { | |
Standard(u16), | |
Extended(u32) | |
} | |
enum Payload { | |
Value { | |
length : u8, | |
data: [u8; 8] | |
}, | |
Remote(u8) |
This file contains hidden or 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
// count down to zero | |
num -= !!(num - 1); | |
// count up to MAX | |
num += (num < MAX); |
This file contains hidden or 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
def signed(chars, index = 0, length = 16): | |
"""convert a `length/4` character hex string into a signed `length`-bit number""" | |
v = int(chars[index:][:(length / 4)], 16) | |
return v if v < (1 << (length - 1)) else v - (1 << length) | |
This file contains hidden or 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
/* | |
simple ring buffer | |
*/ | |
#ifndef RING_BUFFER_H_ | |
#define RING_BUFFER_H_ | |
enum E_RING_BUFFERS { e_RING_OK = 0, e_RING_EMPTY, e_RING_FULL, e_RING_ERROR }; | |
#define T_RING(T, tag, len)\ | |
struct tag { T buffer[len]; unsigned int head, tail; };\ |
This file contains hidden or 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
using System; | |
using System.IO.Ports; | |
using System.Threading; | |
using System.Globalization; | |
namespace Terminal | |
{ | |
static class Program | |
{ | |
static void Main(string[] s) |
This file contains hidden or 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 <string.h> | |
#include <stdio.h> | |
enum ini_parts { | |
ini_section, ini_key, ini_value, | |
ini_section_start = '[', ini_section_end=']', | |
ini_key_value = '=', | |
ini_comment = ';' | |
}; |
This file contains hidden or 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
This gist has moved to FallingBullets/lib.cs on branch algebra |
This file contains hidden or 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
public static int Value(this Control _, NumberStyles s, IFormatProvider p) | |
{ | |
int d; | |
if (int.TryParse(_.Text, s, p, out d)) | |
return d; | |
return 0; | |
} | |
public static double Value(this Control _) | |
{ | |
double d; |
NewerOlder