Skip to content

Instantly share code, notes, and snippets.

View TeamSPoon's full-sized avatar

Douglas R. Miles TeamSPoon

View GitHub Profile
@killerstorm
killerstorm / jfli.diff
Created June 12, 2012 11:10
difference between original jfli-abcl and Ole's version
--- /home/alex/jfli-abcl-orig/jfli-abcl/jfli-abcl.lisp 2004-11-20 21:03:04.000000000 +0200
+++ /home/alex/jfli/jfli.lisp 2012-05-27 19:46:23.955496247 +0300
@@ -6,6 +6,9 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
+; Ported to ABCL by asimon@math.bme.hu.
+; Minor ABCL fixes by A. Vodonosov (avodonosov@yandex.ru).
+; Ripped out CLOS mirror support
@nickmain
nickmain / 8queens.html
Created May 15, 2013 19:04
8 queens problem, handwritten JS and Scheme with the intention of eventually being generated by a Prolog compiler written in Racket
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function makeContext() { return { choices:[], trail:[], halted:false }; }
// Push a new choice point onto the stack
function pushChoice( ctx, choiceThunk ) {
ctx.choices.unshift( { thunk:choiceThunk, trailIndex:ctx.trail.length } );
}
@muupan
muupan / gdl-kif.vim
Created September 8, 2013 04:44
A sintax file for Game Description Language (GDL) in Knowledge Interchange Format (KIF).
" A sintax file for Game Description Language (GDL) in Knowledge
" Interchange Format (KIF).
"
" Put this file in .vim/syntax/ and and add set filetype gdl-kif
" Example:
" au BufRead,BufNewFile *.kif set filetype=gdl-kif
syntax region gdlKifLineComment start=+;+ end=+$+
syntax match gdlKifArrow '<='
syntax keyword gdlKifFactRelation base init true next

Google Apps Script Document Utilities

  • getAllLinks.js

  • getAllLinks(element) - returns array of all UrlLinks in Document

  • findAndReplaceLinks(searchPattern,replacement) - changes all matching links in Document

  • changeCase.js - Document add-in, provides case-change operations in the add-in Menu.

  • onOpen - installs "Change Case" menu

  • _changeCase - worker function to locate selected text and change text case. Case conversion is managed via callback to a function that accepts a string as a parameter and returns the converted string.

  • helper functions for five cases

@mndrix
mndrix / benchmark.prolog
Created May 7, 2014 15:25
Database predicate benchmarks (SWI Prolog)
:- dynamic asserted_a/1, asserted_z/1.
:- b_setval(global_variable, []).
count(1_000_000).
my_asserta(N) :- asserta(asserted_a(N)).
my_assertz(N) :- assertz(asserted_z(N)).
my_recorda(N) :- recorda(recorded_a, N).
my_recordz(N) :- recordz(recorded_z, N).
my_flag(N) :- flag(some_flag, _, N).
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function makeContext() { return { choices:[], trail:[], halted:false }; }
// Push a new choice point onto the stack
function pushChoice( ctx, choiceThunk ) {
ctx.choices.unshift( { thunk:choiceThunk, trailIndex:ctx.trail.length } );
}
@jp-diegidio
jp-diegidio / MinimiseCandies.pl
Last active August 29, 2015 14:27
Prolog Puzzles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
How few candies does the teacher need?
--------------------------------------
Problem:
Alice is a teacher of kindergarten. She wants to give some candies to
the children in her class. All the children sit in a line and each of
them has a rating score according to his or her usual performance.
@jp-diegidio
jp-diegidio / Nan.Kernel.Ex.pl
Created September 3, 2015 01:51
Answer Sources in Prolog (SWI) - Preview
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
Answer Sources in Prolog (SWI) - Preview
Answer Sources: Extensions
Copyright (c) 2015 Julio P. Di Egidio
http://julio.diegidio.name/
All rights reserved.
Answer Sources: Extensions
--------------------------
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, first visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
;; (load "cynd/cb-prolog.lisp")
#+Allegro
(sl::cpushnew :CYC-COMMON-LISP *features*)
#+Allegro
(use-package :CYC)
?- use_module(library(semweb/sparql_client)).
true.
?- sparql_query('CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } LIMIT 1',
Row,
[ host('localhost'),
path('/w/index.php/Special:SPARQLEndpoint'),
port(8080) ]).
ERROR: Domain error: `sparql_result_document' expected, found `'application/xml'' (<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">