Skip to content

Instantly share code, notes, and snippets.

View mosampaio's full-sized avatar

Marcos Sampaio mosampaio

  • Sydney, Australia
View GitHub Profile
@mosampaio
mosampaio / README.md
Last active June 25, 2022 02:00
Simple Phone Verification with Twilio, Node.js, Mongoose, and jQuery Raw

Please make sure you have set the following environment variables:

(This URL should be accessible thru the web. You can use Ngrok to help you if you are testing locally.)

export TWIML_SERVER_URL=https://www.example.org/twiml/

(This information can be found in your Twilio dashboard)

export TWILIO_ACCOUNT_SID=your-account-sid
@mosampaio
mosampaio / README.md
Last active January 13, 2021 08:02
Gmail Api OAuth Using Node.js Express - part 2

How to Run?

  • Make sure there is a mongodb instance running locally.

  • First export the environment variables.

export CLIENT_ID=your-client-id
export CLIENT_SECRET=your-client-secret
export DOMAIN_URL=your-domain-url
@mosampaio
mosampaio / app.php
Last active August 18, 2019 20:08
How to consume a json Rest API with PHP using Guzzle
<?php
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://api.github.com',
'timeout' => 5.0,
]);
@mosampaio
mosampaio / SpringLibrary.java
Created August 19, 2016 19:07
How to consume a json Rest API with Java using Spring
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import static java.util.Arrays.asList;
public class SpringLibrary {
@mosampaio
mosampaio / Gemfile
Last active September 1, 2016 17:51
Simple Phone Verification with Twilio, Ruby, SQLite, and jQuery Raw Raw
source 'https://rubygems.org'
gem 'sinatra', '1.4.7'
gem 'data_mapper', '1.2.0'
gem 'dm-sqlite-adapter', '1.2.0'
gem 'twilio-ruby', '4.11.1'
@mosampaio
mosampaio / README.md
Last active September 1, 2016 15:12
Simple Phone Verification with Twilio, Python, SQLite, and jQuery Raw

How to run it locally?

  • Install the dependencies.
pip install -r requirements
  • Create the database.
@mosampaio
mosampaio / README.md
Last active September 1, 2016 14:21
Gmail Api OAuth Using Node.js Express - part 1

How to Run?

  • Make sure there is a mongodb instance running locally.

  • First export the environment variables.

export CLIENT_ID=your-client-id
export CLIENT_SECRET=your-client-secret
export DOMAIN_URL=your-domain-url
@mosampaio
mosampaio / app.php
Last active August 24, 2016 17:27
How to consume a json Rest API with PHP using PHP Curl
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("user-agent: my app"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, "https://api.github.com/repos/twilio/twilio-php/contributors");
$result = curl_exec($ch);
curl_close($ch);
@mosampaio
mosampaio / app.php
Last active August 24, 2016 17:26
How to consume a json Rest API with PHP using Unirest
<?php
require __DIR__ . '/vendor/autoload.php';
$response = Unirest\Request::get('https://api.github.com/repos/twilio/twilio-php/contributors');
print_r($response->body);
@mosampaio
mosampaio / app.php
Last active August 24, 2016 17:26
How to consume a json Rest API with PHP using Httpful
<?php
require __DIR__ . '/vendor/autoload.php';
$url = "https://api.github.com/repos/twilio/twilio-php/contributors";
$response = \Httpful\Request::get($url)->expectsJson()->send();
print_r($response->body);