This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function(){ | |
var $head = jQuery('head'); | |
var img_src = jQuery('img').attr('src'); | |
if (img_src.indexOf('http://') == -1 && img_src.indexOf('https://') == -1) | |
img_src = window.location.protocol + '//' + window.location.hostname + jQuery('img').attr('src'); | |
var ogp_tags = {'title': $head.find('title').text().trim(), | |
'url': window.location.href, | |
'description': '[%description%]' ? '[%description%]' : jQuery('.lead').html(), | |
'image': '[%image%]' ? '[%image%]' : img_src, | |
'type': '[%type%]' ? '[%type%]' : 'website'}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getElementsByClassName(classname, node) { | |
if(!node) node = document.getElementsByTagName("body")[0]; | |
var a = []; | |
var re = new RegExp('\\b' + classname + '\\b'); | |
var els = node.getElementsByTagName("*"); | |
for(var i=0,j=els.length; i<j; i++) | |
if(re.test(els[i].className))a.push(els[i]); | |
return a; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Imagine you want to develop a facebook canvas app. | |
This snippet will do all the auth dance without requiring the user to click on login. | |
But if the user is not logged in facebook, it will ask for the user to login. | |
Tip: Open the browser console to see debug messages. | |
Followed instructions of Facebook: https://developers.facebook.com/docs/howtos/login/getting-started/ | |
It's is possible to improve this code with more error handling. | |
*/ | |
if (Meteor.is_client) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isClient) { | |
Meteor.startup(function(){ | |
Session.set('MediasLoading', true); | |
Meteor.autosubscribe(function(){ | |
Meteor.subscribe('Medias', function(){ | |
Session.set('MediasLoading', false); | |
}); | |
}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_data = function(user_id, path, fql) { | |
var token = Meteor.users.findOne(user_id).services.facebook.accessToken, | |
fb_url = 'https://graph.facebook.com', | |
response; | |
if (path) { | |
response = Meteor.http.get(fb_url + path + '?access_token=' + encodeURIComponent(token)); | |
} else { | |
response = Meteor.http.get(fb_url + '/fql?q=' + fql + '&access_token=' + encodeURIComponent(token)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.fbAsyncInit = function() { | |
// init the FB JS SDK | |
FB.init({ | |
appId : '436933159676108', // App ID from the App Dashboard | |
// channelUrl : '//localhost:3000/channel.html', // Channel File for x-domain communication | |
channelUrl : 'https://www.friendtrumps.com/channel.html', // Channel File for x-domain communication | |
status : true, // check the login status upon init? | |
cookie : true, // set sessions cookies to allow your server to access the session? | |
xfbml : true, // parse XFBML tags on this page? | |
frictionlessRequests : true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(d, debug){ | |
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement('script'); js.id = id; js.async = true; | |
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js"; | |
ref.parentNode.insertBefore(js, ref); | |
}(document, /*debug*/ true)); | |
window.fbAsyncInit = function() { | |
// init the FB JS SDK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor._reload) { | |
Meteor._reload.onMigrate('session', function() { | |
return [true, { | |
keys : [] | |
}]; | |
}); | |
(function() { | |
var migrationData = Meteor._reload.migrationData('session'); | |
if (migrationData && migrationData.keys) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEEPALIVE_INTERVAL = 5*1000; | |
Meteor.setInterval(function(){ | |
Meteor.call('keepalive'); | |
}, KEEPALIVE_INTERVAL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from views import * | |
app = Flask(__name__) | |
app.register_blueprint(views_bp) | |
views_bp.add_url_rule('/', | |
view_func=MainView.as_view('main')) |