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
'use strict'; | |
const db = require('@arangodb').db; | |
const joi = require('joi'); | |
const _ = require('lodash'); | |
const createRouter = require('@arangodb/foxx/router'); | |
const router = createRouter(); | |
const querystring = require('querystring'); | |
const crypt = require('@arangodb/crypto'); | |
const fs = require("fs") |
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
require 'net/http' | |
require 'json' | |
DB_USER = '<your_user>'.freeze | |
DB_PASS = '<your_password>'.freeze | |
DB_ENDPOINT = 'http+tcp://0.0.0.0:8529'.freeze | |
DUMP_PATH = '/path/to/your/dump/folder/'.freeze # must exist | |
DB_URL = 'http://0.0.0.0:8529'.freeze | |
uri = URI(DB_URL + '/_api/database') |
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
require "kemal" | |
require "jwt" | |
require "json" | |
require "yaml" | |
require "arangocr" | |
require "redis" | |
# Load .env file | |
env_data = YAML.parse File.read(".env.yml") rescue Hash(String, String).new | |
env_data.each { |k, v| ENV[k.to_s] = v.to_s } |
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
curl -fsSL https://gist.github.com/FiveYellowMice/c50490693d47577cfe7e6ac9fc3bf6cf.txt | PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rbenv install --patch 1.9.3-p551 |
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
require "kemal" | |
require "json" | |
connected_sockets = {} of String => Array(HTTP::WebSocket) | |
connected_users = {} of String => Hash(String, JSON::Any) | |
def broadcast(data, sockets) | |
sockets.each do |socket| | |
socket.send data.to_json | |
end |
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
# Beware arguments have a limit size ... | |
require "./mustache_cr/*" | |
require "option_parser" | |
require "json" | |
require "crustache" | |
require "base64" | |
module MustacheCr | |
template = "" | |
json = {} of String => String |
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
var net = require('net'); | |
var HOST = '127.0.0.1'; | |
var PORT = 8888; | |
function rand(i) { | |
return parseInt((Math.random() * 10000) % i); | |
} | |
net.createServer(function(sock) { |
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
var loadFields = function() { | |
// { r: new_row, c: classname, n: name/id, t: type, j: joi validation, l: label, d: data list } | |
fields = [ | |
{ r: true, c: "1-1", n: "title", t: "string", j: joi.string().required(), l: "Title" }, | |
{ r: true, c: "1-2", n: "date", t: "date", j: joi.string().required(), l: "Publishing Date" }, | |
{ r: false, c: "1-2", n: "draft", t: "list", j: joi.string().required(), l: "Draft?", d: [["y", "Yes"], ["n", "No"]] }, | |
{ r: true, c: "1-1", n: "text", t: "text", j: joi.string().required(), l: "Text"} | |
] | |
schema = {} |
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
var loadFields = function() { | |
// { r: new_row, c: classname, n: name/id, t: type, j: joi validation, l: label, d: data list } | |
fields = [ | |
] | |
schema = {} | |
each(fields, function(f) { | |
schema[f.n] = f.j | |
}) | |
} |
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
class Github | |
require 'net/http' | |
require 'json' | |
def initialize(login) | |
@login = login | |
end | |
def favourites_languages | |
json = load_json |