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
""" | |
Testing Pooled = 109s:: | |
ab -n 20000 -c 1 http://192.168.1.2:8888/rp | |
Testing Non Pooled = 148s:: | |
ab -n 20000 -c 1 http://192.168.1.2:8888/r | |
""" | |
import tornado.httpserver | |
import tornado.ioloop |
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
def parse_signed_request | |
signed_request = params['signed_request'] | |
@appdata = '' | |
if signed_request.nil? or signed_request.empty? | |
else | |
encoded_sig, encoded_params = signed_request.split('.') | |
decoded_sig = UrlSafeBase64.decode64(encoded_sig) | |
decoded_params = Yajl::Parser.parse(UrlSafeBase64.decode64(encoded_params)) | |
@sigr = decoded_params |
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
<?php | |
function parse_signed_request($signed_request, $secret) { | |
list($encoded_sig, $payload) = explode('.', $signed_request, 2); | |
// decode the data | |
$sig = base64_url_decode($encoded_sig); | |
$jsondata = base64_url_decode($payload); | |
$data = json_decode($jsondata, true); | |
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') { |
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
<?php | |
include_once('lib/signed_request.php'); | |
?> | |
<script type="text/javascript"> | |
window.fb_signed_request = {app_data:'<?php echo grab_app_data ($_REQUEST['signed_request'], 'FB_APP_SECRET_KEY');?>'}; | |
</script> |
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
<!-- | |
Inclusion of file inline, not using script injection forces | |
load at a determinate point so no need for webtrendsAsyncInit function | |
--> | |
<script src="/static/webtrends.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// create and initialize which calls dcsGetId() | |
var dcs=new Webtrends.dcs().init({dcsid:"YOUR_DCS_ID",timezone:-5}).track(); |
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
<script type="text/javascript"> | |
// this function is called by webtrends.js after it has loaded, the track, init method are chained | |
window.webtrendsAsyncInit = function() { | |
var dcs=new Webtrends.dcs().init({dcsid:"your_dcs_id",timezone:-8}).track(); | |
}; | |
(function() { | |
var s = document.createElement('script'); s.type="text/javascript"; s.async = true; | |
s.src = 'http://s.webtrends.com/js/webtrends.js'; | |
var s2=document.getElementsByTagName("script")[0];s2.parentNode.insertBefore(s,s2); | |
}()); |
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
<script type="text/javascript"> | |
// this function is called by webtrends.js after it has loaded | |
window.webtrendsAsyncInit = function() { | |
var dcs=new Webtrends.dcs().init({dcsid:"your_dcs_id",timezone:-8}); | |
// look for any link with a anchor in it | |
dcs.addSelector('a[href*="#"]', | |
{ | |
transform:Webtrends.anchorTransform, // There are predefined transforms, or create your own | |
argsa:["DCS.dcsuri","/multitrackevents/offsites"] // any args you want to track |
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
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function(){ | |
// show multi-track on custom event capture | |
$("a#mycustom_href").click(function(e){ | |
var href = $(this).attr('href'); | |
Webtrends.multiTrack({ | |
argsa:["DCS.dcsuri","/multitrackevents/my_custom_action","WT.convval","my_custom_action","WT.conv","1"], | |
callback:function(o){ | |
// this occurs After dcs collection or 120 ms(configureable) | |
// whichever is sooner |
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
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function(){ | |
// get list of query params from referrer | |
var qps = Webtrends.Webtrends.getQryParams(document.referrer); | |
// if they just finished auth, it will have access_token in url | |
if (qps && qps.access_token){ | |
Webtrends.multiTrack({argsa:"DCS.dcsuri","/multitrackevents/my_custom_action","WT.convval","fb.install","WT.conv","1"]}) | |
} | |
}); | |
</script> |
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
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function(){ | |
// show multi-track on custom event capture | |
$("form #myform").submit(function(e){ | |
Webtrends.multiTrack({ | |
argsa:["DCS.dcsuri","/multitrackevents/my_custom_action","WT.convval","my_custom_action","WT.conv","1"], | |
callback:function(o){ | |
// this occurs After dcs collection or 120 ms(configureable) | |
// whichever is sooner | |
$("form #myform")[0].submit(); |
OlderNewer