Skip to content

Instantly share code, notes, and snippets.

@reagent
reagent / .gitignore
Last active December 13, 2015 22:59
Just puttin' it out there
main
*.dSYM
@reagent
reagent / dynamic.c
Created February 6, 2013 18:44
Dynamic header structs
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Header {
char *key;
char *value;
} Header;
typedef struct Response {
@reagent
reagent / .gitignore
Last active December 11, 2015 03:58
Simple buffer library
main
*.o
@reagent
reagent / 001_health_check.rb
Created November 21, 2012 16:12
Middleware Response Handler
class HealthCheck
class Middleware
def initialize(application)
@application = application
end
def call(environment)
if environment['PATH_INFO'] == '/health-check'
if HealthCheck.healthy?
#include <stdlib.h>
#include <string.h>
char *
str_upcase(char *source)
{
int i = 0;
int shift = 0;
char ch = '\0';
#include <stdlib.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
if (argc <= 1) {
printf("Error: You must supply a value\n");
return 1;
}
@reagent
reagent / 2p1s.c
Created November 6, 2012 13:42
2 pointers, 1 string
#include <stdio.h>
int
main (int argc, char *argv[])
{
char *name = "Patrick";
char *other = name;
printf("Name is: %s\n", name);
printf("Other is: %s\n", other);
int main(int argc, char *argv[])
{
int val = 5;
switch(val) {
case 0: do {
case 5:
printf("Got here, value is %d\n", val);
case 4:
printf("Got here, value is %d\n", val);
class Bar
def initialize(name)
@name = name
end
def to_str
@name
end
class EmailCollection
include Enumerable
delegate :each, :to => :email_addresses
def initialize(raw_email_addresses)
@raw_email_addresses = raw_email_addresses
end
def valid_emails
select {|e| e.match(email_regex) }