Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void name_prompt( char *buffer, size_t len );
int main( void )
{
char name[15];
@rchowe
rchowe / gist:477582
Created July 15, 2010 21:53
globvar.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char name[15];
static void name_prompt( char *buffer, size_t len );
static void intro();
int main( void )
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <windows.h>
#else
// Unix Stuff
#endif
void pause( int time )
#!/usr/bin/env ruby
=begin
> An interactive novel
> This program parses formatted text files and turns them into an interactive
> novel. Currently, the text files support two types of lines: display lines, or
> lines beginning with a greater than sign. Those lines will be printed out to
> the console. This program also supports prompt lines. These lines will take
> user input and store it in a variable. All other lines are ignored. This file
> can be run as an interactive novel. For completeness, please enter your name
#!/usr/bin/env ruby
=begin
> An interactive novel
> This program parses formatted text files and turns them into an interactive
> novel. Currently, the text files support two types of lines: display lines, or
> lines beginning with a greater than sign. Those lines will be printed out to
> the console. This program also supports prompt lines. These lines will take
> user input and store it in a variable. All other lines are ignored. This file
> can be run as an interactive novel. For completeness, please enter your name
@rchowe
rchowe / Visual Novel.hs
Created July 22, 2010 00:48
The same visual novel program as before, but in haskell
module Main (main) where
import System (getArgs)
import System.IO (hFlush, stdout)
-- Runs a novel from a file
runNovel :: String -> IO [()]
runNovel filename = readFile filename >>= (mapM runLine)
. (filter (\x -> not (isBlank x)))
#include "WPILib.h"
#include "nr/diag/diagnostics_center.h"
#include "nr/diag/observable_wpi.h"
Jaguar motorA( 1 );
nr::diag::diagnostics_center& diagnostics =
nr::diag::diagnostics_center::get_shared_instance();
diagnostics.register_device( motorA );
@rchowe
rchowe / dice.rb
Created August 16, 2011 15:37
Ruby Dice Roller
def roll expression
return [0] if (/^(?<count>\d+)d(?<sides>\d+)(?:s(?<drop>\d+))?$/i =~ expression ).nil?
Array.new( count.to_i, nil ).
map { (Random.rand sides.to_i) + 1 }.
sort.reverse.
take( count.to_i - drop.to_i )
end
expr = "(#{ARGV.join ' '})"; last = ''
@rchowe
rchowe / gist:1648287
Created January 20, 2012 16:34
Selector-based create for jquery
# Creates an element based on a selector.
# Currently only works for tag, id, and class.
$.fn.create = (selector) ->
# Process the selector string if necessary
if typeof selector is 'string'
# Convenience
class Selector
@rchowe
rchowe / .bashrc
Created February 3, 2012 02:41
Sample .bashrc
##
## Slightly nicer .bashrc
## Makes pretty colors and stuff
##
## Set $PATH, which tells the computer where to search for commands
export PATH="$PATH:/usr/sbin:/sbin:/bin:/usr/bin:/etc:/usr/ucb:/usr/local/bin:/usr/local/local_dfs/bin:/usr/bin/X11:/usr/local/sas"
## Where to search for manual pages
export MANPATH="/usr/share/man:/usr/local/man:/usr/local/local_dfs/man"