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
foreach ($intereses as $interess) { | |
if(in_array($interess['Raza']['name'], $interests)){ | |
echo " \t X"; | |
}else{ | |
echo ". \t "; | |
} | |
} |
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 | |
echo "Nombre \t Apellido \t Email \t Teléfono \t Dirección \t Localidad \t Provincia \t País \t Codigo Postal \t Celular \t Empresa \t Suscrito \t Fecha \t"; | |
foreach ($intereses as $interes) { | |
echo $interes['Raza']['name']."\t"; | |
} | |
echo " \n "; | |
?> | |
<?php foreach ($clients as $client) { | |
echo $client['Client']['fname']; | |
echo " \t ".$client['Client']['lname']; |
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
users_loyalty: { | |
82012: [ ], | |
92012: [ ], | |
102012: [ | |
{ | |
_id: { | |
$oid: "509d2256844d8b1810000019" | |
}, | |
name: "Baso car", | |
category: "Automobiles and parts", |
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 get_loyalty(date_range, page_id) | |
loyalty_users = {} | |
date_range.each{|range| | |
loyalty_users.merge!([range[:month], range[:year]] => find_loyaltys(range[:month], range[:year], page_id)) | |
} | |
return loyalty_users | |
end | |
this comes out like |
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
{ | |
102012: [ | |
{ | |
name: "Baso car", | |
category: "Automobiles and parts", | |
id: "276256145729599", | |
month: 10, | |
year: 2012 | |
}, | |
{ |
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 group_by_dates(arr) | |
arr.group_by{|o| [o['date'].year,o['date'].month]} | |
arr.uniq!{|x, v| v['id']} | |
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
duplicated beeing the array | |
def remove_duplicated(duplicated) | |
duplicated.each{|users| | |
users.uniq{|k, v| v["id"]} | |
} | |
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
$LOAD_PATH << './lib' | |
require 'app' | |
# Private: Does the following: | |
# * Gets page's posts from http://graph.facebook.com/page_id/posts. | |
# * Saves/updates posts. | |
# * Redirects to /posts/insights with params. | |
# | |
# Accepts: |
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
[ | |
{ | |
name: "éƒå´‡æ›„", | |
id: "100003725453976", | |
date: "2012-11-07T21:38:05+0000" | |
}, | |
{ | |
name: "Omar Antonio Kennedy", | |
id: "100000461843786", | |
date: "2012-11-06T20:32:25+0000" |
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 extract_likes(posts) | |
u = Array.new | |
posts.each { |post| | |
if post.has_key?("likes") | |
likes = post['likes'] | |
if likes.has_key?("data") | |
users = likes['data'] | |
users.each{|like| | |
like << ['date', post['created_time']] | |
u.push like |
NewerOlder