This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun leanpub-preview () | |
| "Generate a preview of your book @ Leanpub." | |
| (interactive) | |
| (request | |
| "https://leanpub.com/<YOUR-BOOK-SLUG>/preview.json" ;; or better yet, get the book slug from the buffer | |
| :type "POST" ;; and construct the URL | |
| :data '(("api_key" . "53cr3t")) | |
| :parser 'json-read | |
| :success (function* | |
| (lambda (&key data &allow-other-keys) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun leanpub-export () | |
| "Export buffer to a Leanpub book." | |
| (interactive) | |
| (if (file-exists-p "./Book.txt") | |
| (delete-file "./Book.txt")) | |
| (if (file-exists-p "./Sample.txt") | |
| (delete-file "./Sample.txt")) | |
| (org-map-entries | |
| (lambda () | |
| (let* ((level (nth 1 (org-heading-components))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |----------------+---------------------------------------------------------------------------------------------------------------------| | |
| | id | field id | | |
| | field_name | field machine name | | |
| | type | field type | | |
| | module | The module that implements this field | | |
| | active | Whether the module above is enabled | | |
| | storage_type | The storage backend for this field. This is almost always field_sql_storage | | |
| | storage_module | The module that implements the storage backend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python2 | |
| from collections import namedtuple | |
| from ansible.parsing.dataloader import DataLoader | |
| from ansible.vars import VariableManager | |
| from ansible.inventory import Inventory | |
| from ansible.playbook.play import Play | |
| from ansible.executor.task_queue_manager import TaskQueueManager | |
| Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'become', 'become_method', 'become_user', 'check', 'remote_user', 'private_key_file', 'ssh_common_args', 'sftp_extra_args', 'scp_extra_args', 'ssh_extra_args', 'verbosity']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM progrium/cedarish:cedar14 | |
| RUN curl https://github.com/gliderlabs/herokuish/releases/download/v0.3.1/herokuish_0.3.1_linux_x86_64.tgz \ | |
| --silent -L | tar -xzC /bin | |
| # install herokuish supported buildpacks and entrypoints | |
| RUN /bin/herokuish buildpack install \ | |
| && ln -s /bin/herokuish /build \ | |
| && ln -s /bin/herokuish /start \ | |
| && ln -s /bin/herokuish /exec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| core: 7.x | |
| api: '2' | |
| projects: | |
| drupal: | |
| version: ~ | |
| cdn: | |
| type: module | |
| subdir: contrib | |
| version: ~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH data AS( | |
| select array_to_json(array_agg(row_to_json(t))) as data | |
| from ( | |
| SELECT id, name, COALESCE(get_children(id), '[]') as children from genres | |
| ) t | |
| ) SELECT get_tree(data) from data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION get_tree(data json) RETURNS json AS $$ | |
| var root = []; | |
| for(var i in data) { | |
| build_tree(data[i]['id'], data[i]['name'], data[i]['children']); | |
| } | |
| function build_tree(id, name, children) { | |
| var exists = getObject(root, id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION test_func(data json) RETURNS json AS $$ | |
| return JSON.stringify(data); | |
| $$ LANGUAGE PLV8; | |
| SELECT test_func('{"a": {"b":"foo"}}'::json); | |
| test_func | |
| ------------------- | |
| {"a":{"b":"foo"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": 1, | |
| "name": "Arts & Photography", | |
| "children": [ | |
| { | |
| "id": 2, | |
| "name": "Architecture", | |
| "children": [ |