Skip to content

Instantly share code, notes, and snippets.

View gngeorgiev's full-sized avatar
🦀

Georgi N. Georgiev gngeorgiev

🦀
View GitHub Profile
@gngeorgiev
gngeorgiev / el-validate.js
Last active August 29, 2015 14:16
Everlive Validation
define(['lodash'], function (_) {
'use strict';
var defaultValidators = {
$required: {
name: '$required',
attribute: 'ng-required',
cleanName: 'required',
validate: function (value) {
return !!value;
package realbase
import (
// "fmt"
// "gopkg.in/igm/sockjs-go.v2/sockjs"
// "net/http"
"gopkg.in/mgo.v2/bson"
)
func constructMessage(doc bson.M, operation string) bson.M {
@gngeorgiev
gngeorgiev / main.go
Created November 13, 2015 10:53
Twitter analyze spike
package main
import (
"github.com/ChimeraCoder/anaconda"
"net/url"
"fmt"
)
func main() {
anaconda.SetConsumerKey("54EgkqrPnKv8pVaKUhJhqmu3z")
anaconda.SetConsumerSecret("r2wBT4GzKyqkPU4kcYY9n3Omw0GnQHEGEFqN86dXLAnhkVuZEO")
async search(substring) {
const url = `${SEARCH_URL}${encodeURIComponent(substring)}`;
const response = await fetch(url);
const $ = cheerio.load(await response.text());
const videoElements = $(VIDEO_CLASS);
const getIdSelector = id => `${VIDEO_CLASS}[data-context-item-id=${id}]`;
return Array.from(videoElements).map((videoEl) => {
const id = videoEl.attribs['data-context-item-id'];
const idSelector = getIdSelector(id);
@gngeorgiev
gngeorgiev / sashido-telerik-platform-CRUD.js
Last active November 24, 2017 18:52
sashido-telerik-platform-CRUD.js
var gameScore = everlive.data('GameScore');
//Create
gameScore.create({ score : 1337 }).then(...);
//Read
gameScore.getById('item-id').then(...);
@gngeorgiev
gngeorgiev / sashido-telerik-platform-relations.js
Last active November 24, 2017 18:53
sashido-telerik-platform-relations.js
var query = new Everlive.Query();
query.expand({
Post: {
TargetTypeName : 'Post'
}
});
@gngeorgiev
gngeorgiev / sashido-telerik-platform-push.js
Last active November 24, 2017 18:54
sashido-telerik-platform-push.js
everlive.push.notifications.create({
Filter: {
'Parameters.City': 'Tokyo'
},
Message: 'The Giants won against the Mets 2-3.'
}).then(...);
@gngeorgiev
gngeorgiev / sashido-telerik-platform-cloud-function.js
Last active November 24, 2017 19:03
sashido-telerik-platform-cloud-function.js
//cloud function named "findMovie"
Everlive.CloudFunction.onRequest((request, response, done) => {
var filter = new Everlive.Query();
filter.where().eq('title', request.queryString.title);
Everlive.Sdk.fromContext()
.data('Movies')
@gngeorgiev
gngeorgiev / sashido-telerik-platform-cloud-code-for-data-before-update.js
Last active November 24, 2017 19:03
sashido-telerik-platform-cloud-code-for-data-before-update.js
//for content type "Comment"
Everlive.Events.beforeUpdate((request, context, done) => {
//do some validation
done();
});
@gngeorgiev
gngeorgiev / sashido-telerk-platform-social-login.js
Last active November 24, 2017 19:05
sashido-telerk-platform-social-login.js
//login
everlive.authentication.loginWithFacebook(accessToken).then(...);
//link
everlive.users.linkWithFacebook(userId, accessToken).then(...);