Skip to content

Instantly share code, notes, and snippets.

View jpoutrin's full-sized avatar

Jeremie Poutrin jpoutrin

View GitHub Profile
@jpoutrin
jpoutrin / reactNativeSwaggerV2HttpClient
Created May 15, 2017 15:00
This snippet can be used as a client parameter for swagger-client v2 on react native
export const reactNativeHttpClient = {
// implment an execute function
execute: async function (obj) {
const httpMethod = obj.method;
const requestHeaders = obj.headers;
const body = obj.body;
const url = obj.url;
const response = await fetch(obj.url, {
method: httpMethod,
@jpoutrin
jpoutrin / CloudinaryPhotoUploader.js
Last active April 6, 2017 17:53
Photo Uploader for Cloudinary compatible with react native - no jquery
import CryptoJS from 'crypto-js';
import _ from 'lodash';
// http://cloudinary.com/documentation/upload_images#creating_api_authentication_signatures
const SUCCESS = 200;
export class Cloudinary {
constructor(apiSecret, apiKey, cloudName = 'my cloud name', createTimestamp = _.now) {
this.apiSecret = apiSecret;