Skip to content

Instantly share code, notes, and snippets.

View sescandell's full-sized avatar

Stéphane sescandell

View GitHub Profile
@sescandell
sescandell / Sample.cs
Last active February 23, 2018 21:42
Azure Function post to Blogger
private static readonly HttpClient _bloggerHttpClient = new HttpClient();
private static async Task<PublishResult> PublishToBlogger(PlaylistItem latestVideo, TraceWriter log)
{
try
{
// Récupération du token
_bloggerHttpClient.DefaultRequestHeaders.Authorization = null;
var content = new FormUrlEncodedContent(new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("client_id", Environment.GetEnvironmentVariable("GoogleApiClientId")),
@sescandell
sescandell / Sample.cs
Created February 18, 2018 22:35
Azure Function Post Youtube to Facebook
private static async Task<bool> PublishToFacebook(PlaylistItem latestVideo, TraceWriter log)
{
// Récupération des variables d'environnement
var pageAccessToken = Environment.GetEnvironmentVariable("FacebookPageAccessToken");
var pageId = Environment.GetEnvironmentVariable("FacebookPageId");
// Publication sur la page
try
{
var postResult = await _httpClient.PostAsync(
@sescandell
sescandell / Sample.cs
Last active February 18, 2018 22:29
Azure Function Youtube list API Sample
using System;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace Company.Function
{
public static class MediumSample
{
[FunctionName("MediumSample")]
@sescandell
sescandell / MyView.cs
Last active April 30, 2016 20:21
Async call
public class MyView : MvxFrameLayout
{
private string _identifier;
public string Identifier
{
get { return _identifier; }
set
{
_identifier = value;
OnIdentifierChanged());
@sescandell
sescandell / AQImageView.cs
Created January 20, 2015 19:19
MvvmCross: Droid - Workaround for Android Images issues (OOM). Based on the use of AQuery: https://code.google.com/p/android-query/ (https://github.com/androidquery/androidquery) and its Xamarin binding https://github.com/Kiranbhat2005/AQueryXamarin
using Android.Content;
using Android.Util;
using Android.Widget;
using System;
using Com.Androidquery;
namespace Sescandell.App.Mobile.Droid.Views.Controls
{
class AQImageView : ImageView
{
public function testDoNotSubmitIfNameNoInRequestAndPostRequest()
{
$form = $this->getMockForm('param1', 'POST');
$this->setRequestData('POST', array(
'somethingelse' => array()
));
$form->expects($this->never())
->method('submit');