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
/* Source: http://stackoverflow.com/questions/5093398/how-to-check-if-a-user-likes-my-facebook-page-or-url-using-facebooks-api | |
*/ | |
function parsePageSignedRequest() { | |
if (isset($_REQUEST['signed_request'])) { | |
$encoded_sig = null; | |
$payload = null; | |
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2); | |
$sig = base64_decode(strtr($encoded_sig, '-_', '+/')); | |
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), 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
<?php | |
$signed_request = $_REQUEST["signed_request"]; | |
list($encoded_sig, $payload) = explode('.', $signed_request, 2); | |
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); | |
$app_data = isset($data["app_data"]) ? $data["app_data"] : ''; | |
$_REQUEST["fb_page_id"] = $data["page"]["id"]; | |
$access_admin = $data["page"]["admin"] == 1; |
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 | |
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/ | |
class ElasticSearch { | |
public $index; | |
function __construct($server = 'http://localhost:9200'){ | |
$this->server = $server; | |
} |
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() { | |
var iframes = document.getElementsByTagName('iframe'); | |
for (var i = 0; i < iframes.length; i++) { | |
var iframe = iframes[i]; | |
var players = /www.youtube.com|player.vimeo.com/; | |
if(iframe.src.search(players) !== -1) { | |
var videoRatio = (iframe.height / iframe.width) * 100; | |
iframe.style.position = 'absolute'; |
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
// Based off example code from Hal Robertson | |
// https://github.com/halrobertson/test-restify-passport-facebook | |
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao | |
var restify = require('restify') | |
// config vars | |
var FB_LOGIN_PATH = '/api/facebook_login' | |
var FB_CALLBACK_PATH = '/api/facebook_callback' | |
var FB_APPID = '<<YOUR APPID HERE>>' |
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 | |
/* | |
* Resets password, copy this into Users table in MySQL | |
* Drupal 7 | |
*/ | |
define('DRUPAL_ROOT', getcwd()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
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
/** | |
* Force location of /tmp for Appfog | |
*/ | |
$conf['file_temporary_path'] = realpath($_SERVER['DOCUMENT_ROOT'].'/../tmp'); | |
/* END */ |
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
# Checkout https://drupal.org/node/2146223 | |
# And https://github.com/mikebell/drupaldev-nginx | |
# | |
## | |
# cd ~/Vagrant | |
# vagrant box list | |
# vagrant init ubuntu12 |
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 validateCleanPrice($num) { | |
$cleanString = preg_replace('/([^0-9\.,])/i', '', $num); | |
$onlyNumbersString = preg_replace('/([^0-9])/i', '', $num); | |
$separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString) - 1; |
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
/** | |
* Image RollOver Effect | |
* ======================================================================== | |
*/ | |
jQuery(".rollover").hover( | |
function () { | |
var iconName = jQuery(this).attr("src"); | |
var rollover = iconName.replace( /active/, 'rollover' ); | |
jQuery(this).attr({ src: rollover }); | |
}, |
OlderNewer