jq is useful to slice, filter, map and transform structured json data.
brew install jq
-- export family trees | |
-- by Putnam https://gist.github.com/Putnam3145/34f7046481256cc4709d | |
--[====[ | |
family | |
====== | |
TODO | |
family -exportToCSV -this -heritage | |
family -exportToFamilyScript -this -heritage | |
]====] |
class Hash | |
def self.nmerge(*hashes, &block) | |
keys = hashes.map(&:keys).flatten.uniq | |
rhashes = hashes.reverse | |
keys.inject({ }) do |output, key| | |
if block | |
output[key] = block.call(key, hashes.map{ |x| x[key]}) | |
else | |
rhashes.each do |hash| | |
if hash[key] |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>MathML and SVG in text/html</title> | |
</head> | |
<body> | |
<a href="https://developer.mozilla.org/en/Code_snippets/Embedding_SVG">Source</a> | |
<h1>SVG in text/html</h1> | |
<p><svg height=86 width=90 viewBox='5 9 90 86' style='float: left;'> | |
<path stroke=#F53F0C stroke-width=10 fill=#F5C60C stroke-linejoin=round d='M 10,90 L 90,90 L 50,14 Z'/> |
require 'rubygems' | |
require 'doc_raptor' | |
TEN_SECONDS = 10 | |
FIVE_MINUTES = 300 | |
DocRaptor.api_key "YOUR_API_KEY_HERE" | |
pdf_html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en"><body><a href="http://google.com">google</a></body></html>' |
using System; | |
using System.IO; | |
using System.Text; | |
using System.Net; | |
using System.Web; | |
namespace DocRaptorConsoleExample { | |
class DocRaptor { | |
private const string PostFormat = "doc[{0}]={1}&doc[name]={2}&doc[document_type]={3}&doc[test]={4}"; | |
private const string ApiKey = @"YOUR API KEY HERE"; |
# Code review | |
# | |
# This seems really verbose...seems that there should be a simpler way to conditionally set | |
# the value of a variable. I would like to write something like: | |
# body = post.get_formatted_body || "" | |
# | |
# That fails when the post is nil. This helper has to deal with a nil post object being passed in | |
# so I added the .nil? check. This is a contrived version of the situation I have, so don't | |
# nitpick the details. | |
# |
# -*- coding: utf-8 -*- | |
module Color | |
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33, :magenta => 35 } | |
end | |
class Test::Unit::Slow | |
alias :old_long_display :long_display | |
def long_display | |
time_index = /\d+\.\d+s$/ =~ old_long_display | |
time = old_long_display[time_index..-1] if index |
module ActiveSupport | |
module Testing | |
module Declarative | |
alias :tu_test_original :test | |
# test "verify something", [:slow, :wip] do | |
# ... | |
# end | |
def test(name, tags = nil, &block) |