Skip to content

Instantly share code, notes, and snippets.

View emersonbroga's full-sized avatar
:octocat:
Let's code!

Emerson Brôga emersonbroga

:octocat:
Let's code!
View GitHub Profile
@emersonbroga
emersonbroga / index.php
Created November 27, 2012 20:40
Find Facebook Current User
function getFacebookCurrentUserId( $secret = null )
{
$data = getFacebookCurrentUser($secret);
return (isset($data['user_id'])) ? $data['user_id'] : null;
}
function getFacebookCurrentUser( $secret = null )
{
@emersonbroga
emersonbroga / index.php
Created November 21, 2012 19:48
Get User Videos from Youtube
function getYoutubeVideos( $username, $limit = null)
{
$url = 'http://gdata.youtube.com/feeds/api/users/'.$username.'/uploads';
$feed = simplexml_load_file($url);
$videos = array();
$limit = ($limit === null ) ? count($feed->entry) : $limit;
$i = 0;
@emersonbroga
emersonbroga / index.php
Created October 26, 2012 21:10
Amazon S3 Zend Example
echo '<pre style="background-color: #FFF; color:#000">';
$s3Key = '';
$s3Sectret = '';
$imagePath = UPLOAD_PATH. DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
$fileName = 'barcode_2012090000110.jpg';
$bucketName = $_SERVER['HTTP_HOST'];
@emersonbroga
emersonbroga / AmazonSES.php
Created October 26, 2012 20:35
Amazon Simple Email Service (SES) connection object
<?php
/**
* Amazon Simple Email Service (SES) connection object
*
* Integration between Zend Framework and Amazon Simple Email Service
*
* @category Zend
* @package Zend_Mail
* @subpackage Transport
@emersonbroga
emersonbroga / functions.php
Created October 26, 2012 09:17
Json Wordpress Api for UITableView in Objective-C projects
function app_api()
{
$return = array('status' => 'error', 'status_msg' => 'Operation Error');
$params = $_GET;
unset($params['action']);
$result = get_posts($params);
if($result){
$return['status'] = 'ok';
@emersonbroga
emersonbroga / functions.php
Created October 15, 2012 18:19
Wp Update URL
/*
* Wp Update URL
* Based on http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/
* Change the url on the database.
* @author Emerson Carvalho (@emersonbroga)
*
* @param $oldUrl STRING REQUIRED ex: http://www.site.com.br
* @param $newUrl STRING OPCIONAL ex: http://www.newsite.com
*
*/
@emersonbroga
emersonbroga / contato.js
Created August 31, 2012 19:25
Emerson Carvalho.com >> Formulário de contato em php + ajax (snippet 3)
var URL = window.location.protocol + '//'+ window.location.host;
$(document).ready(function(){
$('#contact').validate({
rules:{
name:{
required: true,
minlength: 3
},
@emersonbroga
emersonbroga / contato.php
Created August 31, 2012 19:25
Emerson Carvalho.com >> Formulário de contato em php + ajax (snippet 4)
<?php
$toName = 'Emerson Carvalho';
$toEmail = '[email protected]';
$name = '';
$email = '';
$phone = '';
$subject = '';
@emersonbroga
emersonbroga / contato.html
Created August 31, 2012 19:25
Emerson Carvalho.com >> Formulário de contato em php + ajax (snippet 2)
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
@emersonbroga
emersonbroga / contato.php
Created August 31, 2012 18:43
Emerson Carvalho.com >> Formulário de contato em php + ajax (snippet 1)
<?php
$toName = 'Emerson Carvalho';
$toEmail = '[email protected]';
$name = '';
$email = '';
$phone = '';
$subject = '';