Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Vinny Fonseca VinnyFonseca

🏠
Working from home
Block or report user

Report or block VinnyFonseca

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@VinnyFonseca
VinnyFonseca / fb-page-tab-like-gate.js
Last active Dec 7, 2017
Facebook Page Tab Like Gate
View fb-page-tab-like-gate.js
var appId = 'XXXXXXXXXXXXXXX';
// Taken from the App's configuration page
window.fbAsyncInit = function() {
FB.init({
appId: appId,
status: true,
cookie: true,
xfbml: true
});
@VinnyFonseca
VinnyFonseca / Standalone Cookie Implementation
Created Jun 27, 2013
Standalone Cookie Implementation Insert into Body, not Head
View Standalone Cookie Implementation
View Facebook Create Page Tab URL
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
View Facebook Canvas Auto Height
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
var appId = 'XXXXXXXXXXXXX';
window.fbAsyncInit = function() {
FB.init({
appId: appId,
status: true,
cookie: true,
@VinnyFonseca
VinnyFonseca / switch.js
Last active Dec 7, 2017
Switch Statement
View switch.js
switch(n) {
case 1: {
execute code block 1;
break;
}
case 2: {
execute code block 2;
break;
}
@VinnyFonseca
VinnyFonseca / ga.js
Last active Dec 7, 2017
Google Analytics Implementation
View ga.js
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
View empty-object-check.js
function isEmpty(obj) {
if (typeof obj == 'undefined' || obj === null || obj === '') return true;
if (typeof obj == 'number' && isNaN(obj)) return true;
if (obj instanceof Date && isNaN(Number(obj))) return true;
return false;
};
@VinnyFonseca
VinnyFonseca / closest-element-behaviour.js
Last active Mar 15, 2018
Closest Element Behaviour
View closest-element-behaviour.js
document.body.addEventListener('click', function(event) {
if ( !event.target.closest("SELECTOR").length && document.querySelector("SELECTOR").hasClass("active") ) {
// Your function here
};
});
@VinnyFonseca
VinnyFonseca / Twitter Implementation
Created Jun 10, 2013
Twitter Implementation Web Intents
View Twitter Implementation
<script type="text/javascript">
window.twttr = (function (d, s, id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
return window.twttr || (t = {
_e: [],
View Facebook Implementation
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : "XXXXXXXXX",
status : false,
cookie : true,
xfbml : true
});
You can’t perform that action at this time.