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
| import * as express from 'express' | |
| import * as next from 'next' | |
| import { ApolloServer, gql } from 'apollo-server-express' | |
| const port = parseInt(process.env.PORT, 10) || 3000 | |
| const dev = process.env.NODE_ENV !== 'production'; | |
| const app = next({ dev, quiet: false }) | |
| const handle = app.getRequestHandler() |
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
| (ns jats.contribs | |
| (:require [clojure.java.io :as io] | |
| [clojure.zip :as zip] | |
| [clojure.data.xml :as xml] | |
| [clojure.data.zip.xml :as zx] | |
| [clojure.pprint :as pprint]) | |
| (:gen-class :main true)) | |
| (defn contrib-name [name] | |
| (let [first-name (zx/xml1-> name :given-names zx/text) |
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
| # Paul's ZSH Theme, based on several others | |
| PROMPT='$(_user_host)${_current_dir}$(git_prompt_info)%{$reset_color%}${_return_status}%# ' | |
| local _current_dir="%3~ " | |
| local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" | |
| local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" | |
| function _user_host() { | |
| if [[ -n $SSH_CONNECTION ]]; then |
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
| require 'bundler/setup' | |
| require 'pacer' | |
| require 'pacer-neo4j' | |
| #graph = Pacer.tg | |
| graph = Pacer.neo4j('/tmp/test-neo4j') | |
| c1 = graph.create_vertex(name: 'Concept 1') | |
| c2 = graph.create_vertex(name: 'Concept 2') |
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
| # CONSUMER: | |
| require 'amqp' | |
| def setup_connection(connection) | |
| puts "Setting up connection" | |
| channel = AMQP::Channel.new(connection, :auto_recovery => true) | |
| channel.on_error do |ch, channel_close| | |
| raise channel_close.reply_text | |
| end |
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
| def setup_connection(connection) | |
| # open channel, set up exchanges and bindings, subscribe | |
| end | |
| AMQP.start( | |
| :host => '127.0.0.1', | |
| :vhost => '/search', | |
| :timeout => 0.3, | |
| :on_tcp_connection_failure => Proc.new { |settings| puts "Failed to connect"; EM.stop }) do |connection, open_ok| | |
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
| describe "when handling results" do | |
| before(:each) do | |
| AMQP.stub!(:connect) | |
| MQ.stub!(:new) | |
| Nanite::MapperProxy.new('mapperproxy', {}) | |
| @instance = Nanite::MapperProxy.instance | |
| @fanout = stub(:fanout, :publish => true) | |
| @instance.amqp.stub!(:fanout).and_return(@fanout) | |
| @payload = {:payload => ['nanite', 'eventmachine', 'rabbitmq']} | |
| end |
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
| require 'rubygems' | |
| gem 'dm-core' | |
| gem 'dm-types' | |
| require 'dm-core' | |
| require 'dm-types' | |
| class User | |
| include DataMapper::Resource | |
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
| describe DataMapper::Types::Slug do | |
| before(:all) do | |
| class SlugTest | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, Slug | |
| property :title, String | |
| property :title_slug, Slug |