This file contains 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
<!-- PHP Mongo Docs: http://php.net/manual/en/class.mongodb.php --> | |
<html> | |
<body> | |
<h1>MongoHQ Test</h1> | |
<?php | |
try { | |
// connect to MongoHQ assuming your MONGOHQ_URL environment | |
// variable contains the connection string | |
$connection_url = getenv("MONGOHQ_URL"); |
This file contains 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
# gem install mongo bson_ext json | |
require 'rubygems' # if less than Ruby 1.9 | |
require 'mongo' | |
require 'uri' | |
require 'json' | |
def get_connection | |
return @db_connection if @db_connection | |
db = URI.parse(ENV['MONGOHQ_URL']) | |
db_name = db.path.gsub(/^\//, '') |
This file contains 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
// npm install mongodb | |
var mongodb = require('mongodb'); | |
var url = require('url'); | |
var log = console.log; | |
var connectionUri = url.parse(process.env.MONGOHQ_URL); | |
var dbName = connectionUri.pathname.replace(/^\//, ''); | |
mongodb.Db.connect(process.env.MONGOHQ_URL, function(error, client) { | |
if (error) throw error; |
This file contains 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
# npm install mongodb | |
mongodb = require 'mongodb' | |
url = require 'url' | |
log = console.log | |
connection_uri = url.parse(process.env.MONGOHQ_URL) | |
db_name = connection_uri.pathname.replace(/^\//, '') | |
mongodb.Db.connect process.env.MONGOHQ_URL, (error, client)-> | |
throw error if error |
This file contains 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
neo4j = require('./caching_client').createClient | |
port: process.env.NEO4J_PORT | |
host: process.env.NEO4J_HOST | |
username : process.env.NEO4J_LOGIN | |
password : process.env.NEO4J_PASSWORD | |
neo4j.runCypher 'START x = node(0) RETURN x', (err, output, res)-> | |
if err | |
console.log err.message | |
else |
This file contains 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
exports.cors = (req, res)-> | |
origin = (req.headers.origin || "*") | |
if req.method.toUpperCase() == 'OPTIONS' | |
res.writeHead 200, | |
'Access-Control-Allow-Origin': origin | |
'Access-Control-Allow-Credentials': true | |
'Access-Control-Allow-Methods': '*' | |
'Access-Control-Allow-Headers': 'Accept, Authorization, Cache-Control, Content-Type, Origin, Referer, User-Agent, X-CSRF-Token' | |
'Content-Type': 'text/plain' | |
'Server': 'jsonapi' |
This file contains 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
# Usage: (bracket followed by a comma-separated list of names) | |
# hubot bracket Joe, Fred, Tony, Eddy | |
https = require('https') | |
# uses challonge to create a bracket with the given names | |
module.exports = (robot) -> | |
robot.respond /bracket\s+(.+?)$/i, (msg) -> | |
names = msg.match[1] | |
return unless names |
This file contains 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
# Cashcatme. Just like pug bombing, but with flava | |
# | |
# cashcat me - Receive a cashcat | |
# cashcat bomb N - get N cashcats | |
module.exports = (robot) -> | |
robot.respond /cashcat me/i, (msg) -> | |
msg.http("http://cashcatme.heroku.com/bomb?count=1") | |
.get() (err, res, body) -> | |
msg.send JSON.parse(body).cats |
This file contains 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
source :rubygems | |
gem 'sinatra' | |
gem 'httparty' | |
gem 'nokogiri' |
This file contains 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
# Register the FML plugin to middleman | |
module Middleman::Renderers::FAQML | |
def registered(app) | |
begin | |
require "faqml" | |
app.before_configuration { template_extensions :fml => :html } | |
::FAQML::Engine.set_default_options( | |
:buffer => '@_out_buf', | |
:generator => ::Temple::Generators::StringBuffer | |
) |
OlderNewer