Skip to content

Instantly share code, notes, and snippets.

@jimmyz
jimmyz / read-ancestry.php
Created April 8, 2015 22:12
Read the ancestry of a person
<?php
require 'vendor/autoload.php';
session_start();
use Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreeStateFactory;
use Gedcomx\Rs\Client\Options\QueryParameter;
use Gedcomx\Rs\Client\PersonState;
use Gedcomx\Conclusion\Person;
// $personId = "KW4V-6T4"; // John Hannon
$personId = "KW4V-X9F"; //Jon Samsonite
@jimmyz
jimmyz / search-person.php
Created April 7, 2015 19:50
Search for FamilySearch Family Tree Person
<?php
require 'vendor/autoload.php';
session_start();
use Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreeStateFactory;
use Gedcomx\Rs\Client\Util\GedcomxPersonSearchQueryBuilder;
use Gedcomx\Rs\Client\PersonSearchResultsState;
use Gedcomx\Conclusion\Person;
if(isset($_SESSION['fs_access_token'])){
$accessToken = $_SESSION['fs_access_token'];
@jimmyz
jimmyz / gist:f1a6cf18dc114850a881
Created March 27, 2015 22:27
ApiGen command for the gedcomx-php project
apigenb generate -s gedcomx-php/src -d gedcomx-php-docs/docs --access-levels="public" --title="gedcomx-php" --template-config="../../ThemeBootstrap/src/config.neon" --download
@jimmyz
jimmyz / familysearch-auth.php
Last active August 29, 2015 14:17
FamilySearch PHP SDK Proposal
<?php
require 'vendor/autoload.php';
use FamilySearch\Client;
$client = new FamilySearch\Client(array(
'redirectURI'=>'http://localhost:5000/familysearch-auth.php',
'clientId'=>'a0T3000000BfM3mEAF',
'collection_uri' => 'https://sandbox.familysearch.org/platform/collections' //default to the sandbox
));
@jimmyz
jimmyz / gist:7ed286ba1c1942c018e5
Created February 4, 2015 00:11
List of Family History Related Open Source Projects
RootsDev
https://github.com/rootsdev/roots-search (Chrome Plug-in / JavaScript)
https://github.com/rootsdev/familysearch-javascript-sdk
https://github.com/rootsdev/gofamilysearch (Go FamilySearch SDK)
https://github.com/rootsdev/polygenea (Java and D, Collaborative Research-centric Data Model)
https://github.com/rootsdev/familysearch-reference-client (JavaScript/Angular, Tree Client for FamilySearch API)
https://github.com/rootsdev/genealogy-search (Chrome Extension)
https://github.com/rootsdev/people-inspector (Chrome Extension - historical-data.org microdata reader)
@jimmyz
jimmyz / ahnentafel_transpose.rb
Created May 9, 2013 13:41
Merging two pedigrees with Ahnentafel numbering scheme.
# You have a 4 generation pedigree that you would like to extend
# to a 7 generation pedigree.
#
# 8 9 10 11 12 13 14 15
# 4 5 6 7
# 2 3
# 1
#
# If you take the person on the 4th generation and pull its pedigree,
# you can merge the two pedigrees to create a new larger pedigree.
@jimmyz
jimmyz / gist:1162903
Created August 22, 2011 17:00
familysearch_controller stuff
def catch_authentication
yield
rescue RubyFsStack::Unauthorized => e
if e.message =~ /401\.23/ # Unauthorized
serialize_request
please_authenticate
elsif e.message =~ /401\.1/ # Bad Credentials
@message = "Invalid credentials. Please try again."
please_authenticate
else
@jimmyz
jimmyz / gist:1162902
Created August 22, 2011 16:59
helper stuff
class FamilySearchController < ApplicationController
before_filter :get_window
around_filter :catch_authentication
include FamilySearchApiHelper
# Internal, only for Spec purposes.
# get_client_test and serialize_test share behavior that will be
# used accross other controller actions that inherit FamilySearchController
def get_client_test
if(params[:username] && params[:password])
@jimmyz
jimmyz / gist:1162900
Created August 22, 2011 16:58
sorting
@relationships.sort! do |p1,p2|
p1_birth = p1.birth.value.date.astro.earliest.to_i
p2_birth = p1.birth.value.date.astro.earliest.to_i
p1_birth <=> p2_birth
end
FS = Org::Familysearch::Ws::Familytree::V2::Schema
child = FS::Person.new
child.add_name "Jonathan /Hanson/"
child.add_gender "Male"
child.add_birth :date => "1850"
wife = FS::Person.new
wife.add_name "Rebecca /Wilson/"
wife.add_gender "Female"