Skip to content

Instantly share code, notes, and snippets.

Sergei Bocharov godfreyd

  • Yandex
Block or report user

Report or block godfreyd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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, () => {
View index.js
var Render = require('../render'),
render = Render.render;
function getContent(req, res) {
var hello = 'Hello';
var world = 'World';
render(req, res, {
view: 'page-index',
title: 'Main page',
meta: {
View app.js
var path = require('path'),
express = require('express'),
favicon = require('serve-favicon'),
morgan = require('morgan'),
serveStatic = require('serve-static'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
expressSession = require('express-session'),
You can’t perform that action at this time.