Skip to content

Instantly share code, notes, and snippets.

@hamzamu
hamzamu / app.js
Last active August 29, 2015 14:07 — forked from nachiket-p/app.js
if (Meteor.is_client) {
var userName = "PatelNachiket";
Template.hello.greeting = function () {
return "Fetch recent tweets from Twitter stream of user : " ;
};
Template.hello.events = {
'click #fetchButton' : function () {
console.log("Recent tweets from stream!");
$('#fetchButton').attr('disabled','true').val('loading...');
var crypto = Npm.require('crypto'),
consumerKey = 'consumerKey',
consumerSecret = 'consumerSecret',
accessToken = 'accessToken',
accessTokenSecret = 'accessTokenSecret',
url = 'https://api.twitter.com/1.1/statuses/home_timeline.json',
date = new Date,
method = 'GET';
var AUTH_URL = "https://api.glitch.com/oauth2/authorize?response_type=code&client_id=000yourclientid000&redirect_uri=http://yoursitehere/oauth/&scope=identity";
var Auth_Router = Backbone.Router.extend({
routes: {
"": "root",
"oauth/?code=:code": "auth"
},
root: function () {},
auth: function (code) {
Meteor.call('authenticate', code, function (error, result) {
var crypto = Npm.require('crypto'),
consumerKey = 'consumerKey',
consumerSecret = 'consumerSecret',
accessToken = 'accessToken',
accessTokenSecret = 'accessTokenSecret',
url = 'https://api.twitter.com/1.1/statuses/home_timeline.json',
date = new Date,
method = 'GET';
# SYNTAX:
var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches)
var pattern = /pattern/attributes; # same as above
# BRACKETS:
[...]: Any one character between the brackets.
[^...]: Any one character not between the brackets.
OIFS=$IFS;
IFS=",";
# fill in your details here
dbname=DBNAME
user=USERNAME
pass=PASSWORD
host=HOSTNAME:PORT
# first get all collections in the database
@hamzamu
hamzamu / README.md
Last active August 29, 2015 14:20 — forked from dariocravero/README.md

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

// Asynchronous Method.
Meteor.startup(function () {
console.log('starting up');
var fs = __meteor_bootstrap__.require('fs');
fs.readFile('file.json', 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
Meteor.methods({
// Get the connections *real* IP
getConnectionIP: function () {
// No need to make others wait
this.unblock();
// Locals
var conn = this.connection;
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';