View gist:4a8612cc928bf5bb974fd1511d832876
#!/bin/bash | |
#=============================================================================== | |
# | |
# FILE: getgeo.sh | |
# | |
# USAGE: ./getgeo.sh | |
# | |
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your | |
# database | |
# |
View gist:cfcf5e73837314cab98464f9c7c44903
#!/bin/bash | |
#=============================================================================== | |
# | |
# FILE: getgeo.sh | |
# | |
# USAGE: ./getgeo.sh | |
# | |
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your | |
# database | |
# |
View index.bemjson.js
module.exports = { | |
block: 'page', | |
title: 'Title of the page', | |
favicon: '/favicon.ico', | |
head: [ | |
{ elem: 'meta', attrs: { name: 'description', content: '' }}, | |
{ elem: 'css', url: 'index.min.css' } | |
], | |
scripts: [{ elem: 'js', url: 'index.min.js' }], | |
content: [ |
View youtube.js
var google = require('googleapis'), | |
OAuth2 = google.auth.OAuth2; | |
function GoogleYoutube(credentials) { | |
this.oauth2Client = new OAuth2(credentials.client_id, credentials.client_secret, credentials.redirect_url); | |
}; | |
GoogleYoutube.prototype.searchList = function(user, params, callback) { | |
this.oauth2Client.setCredentials({ |
View index.js
var Render = require('../render'), | |
render = Render.render, | |
config = require('../config'), | |
moment = require('moment'), | |
helpers = require('../helpers'), | |
env = process.env; | |
function getContent(req, res) { | |
var passport = req.session.passport || {}, | |
servicesYouTube = config.services.youtube, |
View auth.js
var passport = require('passport'), | |
YoutubeV3Strategy = require('passport-youtube-v3').Strategy, | |
env = process.env; | |
if (!env.YOUTUBE_APP_ID || !env.YOUTUBE_APP_SECRET) { | |
try { | |
var config = require('./config'), | |
servicesYouTube = config.services.youtube; | |
} catch (err) {} | |
} |
View twitter.js
var Twitter = require('twitter'); | |
module.exports = function getContent(config, params) { | |
return new Promise(function(resolve, reject) { | |
new Twitter(config).get('search/tweets', params, function(err, data) { | |
if (err) return reject(err); | |
if(!data.statuses.length) return resolve({}); | |
resolve({ | |
nextPageId: data.statuses[data.statuses.length -1].id, |
View index.js
var Render = require('../render'), | |
render = Render.render, | |
config = require('../config'), | |
moment = require('moment'), | |
helpers = require('../helpers'), | |
env = process.env; | |
/** | |
* Функция-обертка, контроллер. | |
* @function |
View routes.js
var router = require('express').Router(), | |
controllers = require('./controllers'); | |
router | |
.get('/ping/', function(req, res) { | |
res.send('ok'); | |
}) | |
.get('/', controllers.getContent); | |
module.exports = router; |
View index.js
var fs = require('fs'), | |
app = require('./app'), | |
config = require('./config'), | |
env = process.env, | |
port = env.PORT || (env.PORT = config.defaultPort), | |
isSocket = isNaN(port); | |
exports.start = function() { | |
app | |
.listen(port, () => { |
NewerOlder