Beispiel #1
0
 function _push(endpoint, options){
   _validateEndpoint(endpoint);
   optionValidators.data(options);
   var ref = new Firebase(`${baseUrl}/${endpoint}`);
   var returnEndpoint;
   if(options.then){
     returnEndpoint = ref.push(options.data, options.then);
   } else {
     returnEndpoint = ref.push(options.data);
   }
   return returnEndpoint;
 };
Beispiel #2
0
	app.post('/rest/add/article', function (req, res){
		var http = require('http');
		var post = req.body;
		var Firebase = require('firebase');
		var myRootRef = new Firebase('https://rentie.firebaseio.com/article');
		myRootRef.push(post);
		
	  	var wallPost = {
	  	  message: "Fire Notice at "+ post.location
	  	};
	  	graph.get("/oauth/access_token?client_id=CLIENT_ID&client_secret=SECRET_KEY&grant_type=client_credentials", function(err, res){
	  		console.log(res)
			// graph.setAccessToken(res.access_token)			
			// graph.get("/131613223561516",  function(err, res) {
			// 	console.log(res)	  		
			// });

	  		graph.post("/me/feed", wallPost, function(err, ress) {				
	  			console.log(ress.data)	  			
	  		});	
	  		
			graph.get("/me/accounts",  function(err, ress) {				
				console.log(ress.data)
				graph.post("/804124363028186/feed?access_token="+ress.data[0].access_token, wallPost,  function(err, res) {
					console.log(res)
					response.redirect('http://localhost:3100/#/home');	  
				}); 
			});	

	  	})

	  	res.redirect('http://localhost:3100/#/home');
	  	
	});
Beispiel #3
0
var createNewReservation = function(reservation) {
  var resPromise = reservationsRef.push(reservation.attributes);
  return resPromise.then(function() {
    reservation.id = resPromise.key();
    return reservation;
  });
};
Beispiel #4
0
FirebaseUtils.writeChatMessage = function( channelID, messageData ){

	var messageRef = new Firebase("https://amber-inferno-4829.firebaseio.com/channels/" + channelID + "/messages");
	var newPostRef = messageRef.push();
	newPostRef.set( messageData );

}
Beispiel #5
0
	submit() {
		let dateTime = null, onlyDate = false;
		if ( this.state.date && this.state.time ) {
			dateTime = new Date(
				  this.state.date.getFullYear()
				, this.state.date.getMonth()
				, this.state.date.getDate()
				, this.state.time.getHours()
				, this.state.time.getMinutes()
			).getTime();
		} else if ( this.state.date ) {
			dateTime = this.state.date.getTime();
			onlyDate = true;
		} else if ( this.state.time ) {
			return this.setState({ errors: 'Must set a date to set a time'});
		}

		if ( !this.state.title || !this.state.content || !this.state.category ) {
			return this.setState({ errors: 'Title, content, and category are required.' });
		}

		this.postsRef
			.push({
				  category: this.state.category
				, title: this.state.title
				, content: this.state.content
				, dateTime
				, onlyDate
				, author: this.props.user.get(`id`)
			});
		store.dispatch(activateCategory(this.state.category));
		this.setState(this.initialState);
	}
Beispiel #6
0
 return new Promise((resolve, reject) => {
   const suggestion = Suggestions.push({
     generalSuggestion: generalSuggestion || '',
     talkSuggestion: talkSuggestion || '',
   });
   resolve(suggestion);
 });
Beispiel #7
0
        }, (inputValue) => {
            if (inputValue === false)
                return false;
            if (inputValue === '') {
              swal.showInputError('You need to write something!');
                return false
            }

            if (/fuck|bitch|shit|bullshit|cunt|arse|ass|dick/ig.test(inputValue)) {
             swal.showInputError('Come On. Use better language','error');
            }

            else if (inputValue.length > 175) {
              swal.showInputError('Your message is too long!','error');
            }
            else{
            sweetAlert('Nice', 'Your thoughts are valuable to the world', 'success');

            let firebase = new Firebase('https://crackling-heat-8405.firebaseio.com/justchat/topicChatMessages/')
            let uid = sessionStorage.getItem('uid')

            firebase.push({
                text:inputValue,
                uid: uid,
                username: this.state.username

            });
          }
        });
Beispiel #8
0
app.get('/add', function(req, res) {
	var Firebase = require('firebase');
	var myRootRef = new Firebase('https://tomobil.firebaseio.com/test/');
	myRootRef.push({name: 'dd', text: 'tsd'});
    res.setHeader('Content-Type', 'text/plain');
    res.end('ajouter');
});
var addArticle = function(response, post){
	var Firebase = require('firebase');
	var myRootRef = new Firebase('https://rentie.firebaseio.com/article');
	console.log(post)
	myRootRef.push(post)
	response.redirect('http://localhost:3100/#/home');	
}
Beispiel #10
0
 return (dispatch) => {
   dispatch(tongleLoading(true));
   rooms.push({username: '******' + new Date()}, () => {
     dispatch(addRoom);
     dispatch(tongleLoading(false));
   })
 }
Beispiel #11
0
function processOrder(){
  // TODO: what if there's an '?
  var url = document.location.href;
  var name = getParameterByName('name', url);
  var phoneNumber = getParameterByName('phone', url);
  var location = getParameterByName('location', url);
  var food = getParameterByName('food', url);

  console.log(name);
  console.log(location);
  console.log(food);


  var order = {
      name : name,
      phone_number : phoneNumber,
      location : location,
      food_type : food
  };
  firebaseRef.push(order);
  firebaseRef.off();

  //var orderData = [name, phoneNumber, location, food]
  //var payload = orderData.join()
  // new QRCode(document.getElementById("qrcode"), payload);
  // document.location.href='prepare.html';
  toggle_visibility("payment-form");
  toggle_visibility("thank-you");

}
$('#messageInput').keypress(function (e) {
  if (e.keyCode == 13) {
    var name = $('#nameInput').val();
    var text = $('#messageInput').val();
    myDataRef.push({name: name, text: text});
    $('#messageInput').val('');
  }
});
Beispiel #13
0
router.post('/user', function *(next) {
  var id = yield firebaseRef.push({name : this.request.body.name, count: 0, instagram:true, time: new Date().getTime()});
  var data = yield firebaseRef.child(id.key()).once("value");
  this.status = 201;
  this.body = {
    [id.key()] : data.val()
  };
});
Beispiel #14
0
 handleSubmit(e) {
     e.preventDefault();
     this.firebaseRef.push({
         name: this.state.name,
         email: this.state.email,
         goal: this.state.goal
     });
 }
 create(item) {
   const items = this.items;
   item.id = uuid.v4();
   this.setState({
     items: items.concat(item)
   });
   itemData.push(item);
   return item;
 }
Beispiel #16
0
		testData.forEach(function(item){
			var item_ref = test_ref.push(item,function(){
				counter--;
				if (counter === 0 ) {
					cb();
				}
			});
			allIds.push(item_ref.name());
		});
Beispiel #17
0
				data.forEach(function(tweet){
					var t = tweet.text;
					//remove '@username' and leading left or right spaces
					var clean_text = t.replace(/@\w+/g, '').replace(/^\s+|\s+$/g, '').toLowerCase();;
					var classification_res = classifier.classify(clean_text);
					result[classification_res] += 1;
					//save to firebase
					fbase.push({id: tweet.id, screen_name: scrname, date: tweet.created_at, text: clean_text, classification: classification_res});
				});
 beforeEach(function (done) {
     couponTest++;
     var ref = new Firebase('https://stripe-fire.firebaseio.com/coupons/test-' + couponTest);
     ref.push({
         percent_off: 25,
         duration: 'repeating',
         duration_in_months: 3
     }, done);
 });
 createToken(function (err, token) {
     if (err) {
         done(err);
     } else {
         ref.push({
             card: token.id
         }, done);
     }
 });
Beispiel #20
0
 return new promise(function(resolve, reject) {
   tagIndexRef = new Firebase(config.firebaseV2 + '/tag_index/' + postId);
   tagIndexRef.push(tagName, function(err) {
     if (err)
       reject(err);
     else
       resolve();
   });
 });
Beispiel #21
0
 data.forEach((player) => {
   let playerObj = {
     id: player.id,
     player_name: player.player_name
   }
   fluffyPancakes.push(playerObj)
     .then(() => {
       console.log('pushed in player object');
     })
 });
var addAlbum = function(album, ipAddress, callback) {
	album["location"] = ipAddress;
	album["time"] = new Date().getTime();
	if(album["album"] && album["artist"] && album["image"] && !duplicates[album["image"]]) {
		albumRef.push().set(album);
		callback(null);
	} else {
		callback(new Error("Album JSON was missing some items or was a duplicate"));
	}
};
Beispiel #23
0
app.post('/transaction',function(req,res){
	req.body.model = JSON.parse(req.body.model);
	var firebaseRef = new Firebase('https://nikhil-venkat.firebaseio.com/');
	firebaseRef.push(req.body.model);
	var response = {
		status: 200
	};
	response = JSON.stringify(response);
	res.end(response);
});
 socket.on("new message", function(data) {
     socket.broadcast.emit("new message", {
         userName: socket.userName,
         message: data
     });
     messagesRef.push({
         userName: socket.userName,
         message: data
     });
 });
    child_process.exec('scutil --get LocalHostName', function(err, hostname) {
      if (err) {
        done(err);
        return;
      }

      hostname = hostname.trim() + '.local';

      hostnameRef = hostnameListRef.push(hostname, done);
    });
Beispiel #26
0
    logAdd: function (category) {
        var firebaseLogRef = new Firebase('http://mutombo-log.firebaseio.com/');

        firebaseLogRef.push({
            type: "Adding card",
            entry: "Victima: " + document.getElementById('usersSelect').options[document.getElementById('usersSelect').selectedIndex].innerHTML,
            reason: category,
            date: Moment().zone('-03:00').format('DD/MM/YYYY, HH:mm')
        });
    }
Beispiel #27
0
    feed("http://feeds.bbci.co.uk/news/rss.xml", function(err, articles) {
    if (err) throw err;
    firebaseNotesRef.set(null);
    for (var i = 5 - 1; i >= 0; i--) {
        firebaseNotesRef.push({
            Title:articles[i].title,
            Content:articles[i].content
        });
    }
});
 createToken(function (err, token) {
     if (err) {
         done(err);
     } else {
         ref.push({
             amount: 400,
             currency: 'usd',
             card: token.id
         }, done);
     }
 });
 beforeEach(function (done) {
     planTest++;
     var ref = new Firebase('https://stripe-fire.firebaseio.com/plans/test-' + planTest);
     var planRef = ref.push();
     planRef.set({
         amount: 2000,
         interval: 'month',
         name: planRef.name(),
         currency: 'usd'
     }, done);
 });
Beispiel #30
0
ListActions.createNote.listen( function(data) {
    // By default, the listener is bound to the action
    // so we can access child actions using 'this'
    var addfbaseRef = new Firebase(fUrl);
    addfbaseRef.push(data)
		    	.then( (response) => {
			    	var id = String(response).replace(/https\:\/\/flickering\-fire\-2129\.firebaseio\.com\//g, "");   	
			    	data.id = id;
			    	this.completed(data);})
		    	.catch( (error) => { this.failed(error)});
});