The JSON data is in the following format
{
"Genesis": {
"1": {
"1": "In the beginning..." ,
"2": "..."
| #!/usr/bin/env ruby | |
| # 2011-10-10 20:57:53 +1000 | |
| def merge_sort(a) | |
| return a if a.size <= 1 | |
| l, r = split_array(a) | |
| result = combine(merge_sort(l), merge_sort(r)) | |
| end |
| [ | |
| {name: 'Afghanistan', code: 'AF'}, | |
| {name: 'Åland Islands', code: 'AX'}, | |
| {name: 'Albania', code: 'AL'}, | |
| {name: 'Algeria', code: 'DZ'}, | |
| {name: 'American Samoa', code: 'AS'}, | |
| {name: 'AndorrA', code: 'AD'}, | |
| {name: 'Angola', code: 'AO'}, | |
| {name: 'Anguilla', code: 'AI'}, | |
| {name: 'Antarctica', code: 'AQ'}, |
| $stack, $draws = [], {} | |
| def method_missing *args | |
| return if args[0][/^to_/] | |
| $stack << args.map { |a| a or $stack.pop } | |
| $draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
| end | |
| class Array | |
| def +@ |
| <?php | |
| namespace Acme\DemoBundle\EventListener; | |
| use Symfony\Component\Validator\Validator; | |
| use Doctrine\ORM\Event\LifecycleEventArgs; | |
| /** | |
| * Prevent invalid entities from being updated | |
| * |
| # in controller | |
| # for local files | |
| send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
| # for remote files | |
| require 'open-uri' | |
| url = 'http://someserver.com/path/../filename.jpg' | |
| data = open(url).read | |
| send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |
| import Text.Parsec hiding ((<|>), many) | |
| import Text.Parsec.String | |
| import Text.Printf | |
| import Control.Applicative | |
| data MyType = Single Int | |
| | Tuple MyType MyType | |
| instance Show MyType where | |
| show (Single x) = show x |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| module Squarer where | |
| import JavaScript as JS | |
| foreign import jsevent "input" | |
| (JS.fromInt 0) | |
| inputs: Signal JS.JSNumber | |
| foreign export jsevent "reply" | |
| outputs: Signal JS.JSNumber |
| class API::V1::BaseController < ApplicationController | |
| skip_before_filter :verify_authenticity_token | |
| before_filter :cors_preflight_check | |
| after_filter :cors_set_access_control_headers | |
| def cors_set_access_control_headers | |
| headers['Access-Control-Allow-Origin'] = '*' | |
| headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |