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
I am trying to switch from apache to nginx. for my wordpress and vanillaforums setup. | |
Essentially I need the wordpress rewrite to work correctly with vanilla forums | |
rewrite. | |
I have gist'd the apache rewrite I'm trying to emulate and | |
my current nginx config. |
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
get '/user' do | |
foursquare = Foursquare.new | |
response = foursquare.request '/v1/user.json', :get | |
result = response.body | |
body = JSON.parse(result) | |
user = body['user'] | |
return user['firstname'] # works |
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
get '/callback' do | |
@newuser = Foursquare.prepare_user | |
if @newuser.exists? | |
redirect '/user' | |
else | |
User.save | |
end | |
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
def prepare_user | |
foursquare = Foursquare.new #instatiate | |
response = foursquare.request '/v1/user.json', :get #api method | |
result = response.body | |
body = JSON.parse(result) | |
user = body['user'] #parse response and make user variable | |
#this is where it gets hairy. how should I construct this hash so that I can easily pull out the uid param for verifification |
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 | |
$url = "http://search.twitter.com/search.json?q=from:kylemac"; | |
$contents = file_get_contents($url); | |
$contents = utf8_encode($contents); | |
$results = json_decode($contents); | |
echo '<pre>'; |