Skip to content

Instantly share code, notes, and snippets.

@bfoz
bfoz / jsgf_alexa.rb
Last active August 29, 2015 14:23
Convert JSGF grammars to Alexa examples using Ruby
require 'jsgf'
module JSGF
class Grammar
# Convert a {Grammar} into a set of sample utterances for Alexa
# @option slots [Array] The rule names that should be used as slot names
# @return [Array<String>] An array of the example strings
def to_examples(slots:[])
raise StandardError, "The grammar must have at least one root rule" unless roots
raise StandardError, "The grammar must contain at least one public rule" if roots.empty?

Keybase proof

I hereby claim:

  • I am bfoz on github.
  • I am bfoz (https://keybase.io/bfoz) on keybase.
  • I have a public key whose fingerprint is B233 1462 880A 0173 5F31 0135 90BD 97D7 A09B FBF7

To claim this, I am signing this object:

@bfoz
bfoz / gist:1194063
Created September 5, 2011 04:02
Common options for Module::Starter
module-starter --author="Brandon Fosdick" --email=bfoz@bfoz.net --license=bsd
@bfoz
bfoz / Importing posts from Wordpress into Jekyll.rb
Created May 28, 2011 18:51 — forked from vitobotta/Importing posts from Wordpress into Jekyll.rb
The script I used to import posts from my Wordpress blog into a new Jekyll one.
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
@bfoz
bfoz / fixup_committer_date.sh
Created September 7, 2010 19:24
Force GIT_COMMITTER_DATE = GIT_AUTHOR_DATE
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'
@bfoz
bfoz / .gitignore_xcode
Created May 7, 2010 12:29
.gitignore for Xcode projects
build/
# Xcode stuff
*.app
*.mode1v3
*.pbxuser
@bfoz
bfoz / Makefile
Created February 15, 2010 11:56
Compile and link a bootloader using SDCC
ASM= asx8051
CC= sdcc
BOOTLOADER_ADDRESS=0x3000
OUTPUT_DIR= build
.PHONY: $(OUTPUT_DIR)
.SUFFIXES:
.SUFFIXES: .asm .c .ihx .hex .rel
@bfoz
bfoz / cvs2git howto
Created June 17, 2009 03:35
Convert CVS to git
# cd to cvs2svn dir
# create an options file for the project, then...
./cvs2git --options=cvs2git-ofx.options
# wait...
cd
mkdir myproj
cd myproj
git init
cat ~/cvs2svn-trunk/cvs2svn-tmp/git-blob.dat ~/cvs2svn-trunk/cvs2svn-tmp/git-dump.dat | git fast-import
# create a github repo, then...