Skip to content

Instantly share code, notes, and snippets.

Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c (revision 45224)
+++ ext/readline/readline.c (revision 45225)
@@ -1974,7 +1974,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
require 'spec_helper'
module GEDCOMParser
describe Parser do
let(:output) { double('output').as_null_object }
let(:parser) { Parser.new(output) }
describe '#open_ged_file' do
it "complains and stops whine when run without a filename" do
import unittest
from StringIO import StringIO
import rpn_calc
class RPNTest(unittest.TestCase):
def setUp(self):
self.rpn = rpn_calc.RPN()
(defpackage :verbquiz
(:use :common-lisp))
(in-package :verbquiz)
(defparameter *dictionary* (make-hash-table :test #'equal))
(defun save-dictionary (&key (filename "dictionary.db"))
"Save the program *dictionary* in utf-8 format."
(with-open-file (out filename
class Parser
def initialize(output)
@output = output
end
def open_ged_file(file)
if file.strip.empty?
@output.puts "Can't parse without a GEDCOM file name"
exit
end
@gmcclure
gmcclure / gist:5538047
Created May 8, 2013 03:49
an attempt to model a has_many :through with factory girl ...
# app/models/user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
@gmcclure
gmcclure / sieve.py
Created April 27, 2013 23:14
Praxis, Sieve of Eratosthenes
# sieve of eratosthenes
import math
import time
class Sieve(object):
def find_primes_to_max(self, n):
n += 1
primes_filter = [0] * n
@gmcclure
gmcclure / rpn.py
Created April 27, 2013 22:53
Programming Praxis, RPN
import sys
class RPN(object):
def __init__(self):
self._stack = []
self._expr = ''
self._operators = '+-*/'
def read_expr(self, out=sys.stdout):
@gmcclure
gmcclure / list.h
Created November 15, 2012 18:40
Simple doubly linked list implementation, from the Linux kernel
#ifndef __LIST_H
#define __LIST_H
/* This file is from Linux Kernel (include/linux/list.h)
* and modified by simply removing hardware prefetching of list items.
* Here by copyright, credits attributed to wherever they belong.
* Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
*/
/*
@gmcclure
gmcclure / glib.h
Created November 15, 2012 18:38
GLIB - Library of useful routines for C programming
/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of