Skip to content

Instantly share code, notes, and snippets.

@reagent
reagent / xmas.ino
Created December 2, 2013 08:36
ruff & reddy
class Note {
short frequency;
int tempo;
public:
String name;
Note(String name) {
this->name = name;
this->tempo = 150;
<%=
begin
render "pages/#{foo}/data"
rescue ActionView::MissingTemplate
render "pages/data"
end
%>
@reagent
reagent / pad.c
Last active December 15, 2015 18:59
dat pad
char *
pad(char *in, size_t width)
{
char *padded = NULL,
*fmt = NULL;
check(asprintf(&fmt, "%%%lds", width) >= 0);
check(asprintf(&padded, fmt, in) >= 0);
free(in);
@reagent
reagent / .gitignore
Created April 1, 2013 14:51
Implementation of realloc / malloc
realloc
*.o
*.dSYM
@reagent
reagent / .gitignore
Created April 1, 2013 14:50
String Calculator
calc
*.o
*.dSYM
@reagent
reagent / malloc_size.c
Created March 25, 2013 19:49
Checking size of allocation
#include <stdlib.h>
#include <stdio.h>
#include <malloc/malloc.h>
int
main()
{
char *thing = malloc(1 * sizeof(char));
printf("Alloc'd: %ld bytes\n", malloc_size(thing));
@reagent
reagent / .gitignore
Last active December 15, 2015 07:18
Dynamic array + union
main
*.o
*.dSYM
@reagent
reagent / .gitignore
Created March 18, 2013 17:45
Dynamic Array
*.o
main
*.dSYM
@reagent
reagent / .gitignore
Last active December 14, 2015 00:59
File parsing w/ linked list / array
array
list
*.o
*.dSYM
main
*.dSYM