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 restify = require('restify'), | |
oboe = require('oboe'); | |
var client = restify.createClient({ | |
url: 'http://localhost:3000', | |
version: '*' | |
}); | |
client.get('/data', function (err, req) { | |
if (err) { |
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'; | |
var aws = require('aws-sdk'), | |
s3blobs = require('s3-blob-store'), | |
fsblobs = require('fs-blob-store'), | |
fs = require('fs'), | |
path = require('path'); | |
var workLocally = false; |
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 url = require('url'); | |
var http = require('http'); | |
//var imgUrl = 'http://upload.wikimedia.org/wikipedia/commons/9/95/Big_Pine_landscape.jpg'; | |
var imgUrl = 'http://downloads.xenproject.org/Branding/Images/Mascot/Xen%20Big%20Panda%204242x3129.png'; | |
//var imgUrl = 'http://stackoverflow.com/questions/19934406/verify-mime-type-of-uploaded-files-in-node-js'; | |
var options = url.parse(imgUrl); | |
http.get(options, function (response) { |
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 CloudFoundryApi = require('cloud-foundry'); | |
var _ = require('lodash'); | |
var cf_api = new CloudFoundryApi('https....', { | |
token: '.... refresh token' | |
}); | |
cf_api.organizations.list({}, function (err, page) { | |
if (err) { | |
return console.log(err); |
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
PUT db1 | |
PUT db1/table1/_mapping | |
{ | |
"dynamic_templates": [{ | |
"non_analyzed_string": { | |
"match": "*", | |
"match_mapping_type": "string", | |
"mapping": { | |
"type": "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
const fastify = require('fastify'); | |
function init(serverFactory) { | |
const app = fastify({ serverFactory }); | |
app.get('/', (request, reply) => reply.send({ hello: 'world' })); | |
return app; | |
} | |
if (require.main === module) { | |
// called directly i.e. "node app" |
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
const util = require('util'); | |
const Transform = require('stream').Transform; | |
function Slicer (options) { | |
if (!(this instanceof Slicer)) { | |
return new Slicer(options); | |
} | |
Transform.call(this, options); | |
} |
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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta name="theme-color" content="#000000"> | |
<title>jQuery App</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js" ></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/i18next/11.6.0/i18next.min.js" ></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-i18next/1.2.1/jquery-i18next.min.js" ></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/i18next-browser-languagedetector/2.2.3/i18nextBrowserLanguageDetector.min.js"></script> |
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
if (window.i18next) { | |
window.i18next | |
.use(window.i18nextXHRBackend) | |
.use(window.i18nextBrowserLanguageDetector) | |
.init({ | |
debug: false, | |
fallbackLng: 'en', | |
backend: { | |
loadPath: '../locales/{{lng}}/{{ns}}.json' |
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
import React, { Component } from 'react'; | |
import { translate } from 'react-i18next'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
const { t, i18n } = this.props; | |
const changeLanguage = (lng) => { | |
i18n.changeLanguage(lng); |
OlderNewer