This file contains hidden or 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 ( strstr( $_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit' ) { | |
// show OpenGraph headers for page | |
} else { | |
// Password protected page / login page | |
} |
This file contains hidden or 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
# run the adb shell | |
adb shell | |
# basic recording from shell | |
screenrecord --verbose /sdcard/nexus5.mp4 | |
# press Ctrl-C to stop | |
# recording for 30 seconds | |
screenrecord --verbose --time-limit 30 /sdcard/nexus5.mp4 | |
This file contains hidden or 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"> | |
function addToPage() { | |
var obj = { | |
method: 'pagetab', | |
redirect_uri: '[redirect_url]', | |
}; | |
FB.ui(obj); | |
} | |
</script> |
This file contains hidden or 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
FB.Canvas.getPageInfo( function(info) { | |
console.log(info); | |
}); |
This file contains hidden or 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
<!-- anchor example --> | |
<a href="#" onclick="FB.Canvas.scrollTo( 0, 500 );">Click here to enter</a> | |
<!-- anchor with jQuery dynamic placement example --> | |
<a href="#" onclick="FB.Canvas.scrollTo( 0, $('.enter-btn').offset().top );">Click here to enter</a> | |
<!-- page load example --> | |
<script type="text/javascript"> | |
window.fbAsyncInit = function() { | |
FB.init({ |
This file contains hidden or 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
html, body { | |
width: 810px; | |
overflow: hidden; | |
} |
This file contains hidden or 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() { | |
FB.init({ | |
appId : 'xxx', // App ID | |
channelUrl : 'channel.html', // Channel File | |
status : true, // check login status | |
cookie : true, // enable cookies to allow the server to access the session | |
xfbml : true // parse XFBML | |
}); | |
// Remove those pesky scrollbars |
This file contains hidden or 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 | |
$appId = 'aaaaaaaaaaaa'; | |
$appSecret = 'bbbbbbbbbbbb'; | |
// init facebook | |
$facebook = new Facebook( array( 'appId' => $appId, 'secret' => $appSecret ) ); | |
// get user_id, 0 if not logged in | |
$user = $facebook->getUser(); |
This file contains hidden or 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 | |
$sr = $facebook->getSignedRequest(); | |
// check if the page has been liked | |
if ( !isset( $sr ) || !isset( $sr['page']['liked'] ) || $sr['page']['liked'] != true ) { | |
// likegate | |
header( 'Location: likegate.php' ); | |
} else { | |
// regular content |