Skip to content

Instantly share code, notes, and snippets.

View brunossn's full-sized avatar

Bruno Soares Nepomuceno brunossn

View GitHub Profile
@brunossn
brunossn / UrlFactory.cs
Created May 8, 2019 20:51
An C# auxiliary class to easily create URLs with parameters
public class UrlFactory
{
private Dictionary<string, string> _parameters;
private string _url;
public UrlFactory(string url)
{
_url = url;
_parameters = new Dictionary<string, string>();
}
@brunossn
brunossn / WindowExtension.cs
Created May 3, 2019 14:33
A Window.ShowDialog() overload method to set the onwer window.
public static class WindowExtension
{
public static bool? ShowDialog(this Window window, Window parentWindow)
{
window.Owner = parentWindow;
return window.ShowDialog();
}
}
@brunossn
brunossn / ObservableCollectionExtensions.cs
Created March 12, 2019 22:33
ObservableCollection.AddRange() extension in C#
public static class ObservableCollectionExtensions
{
public static void AddRange<T>(this ObservableCollection<T> lista, IEnumerable<T> items)
{
foreach(var item in items)
{
lista.Add(item);
}
}
}
@brunossn
brunossn / salescope_linx.sql
Created August 28, 2018 19:47
Query de integração do Salescope com vendas de atacado do Visual LINX
SELECT A.NF_SAIDA 'Nota fiscal',
A.FILIAL 'Filial',
B.UF 'Estado',
B.CIDADE 'Cidade',
'' 'Região',
'' 'Gerente',
A.AGENTE 'Representante',
'' 'Canal de vendas',
'' 'Segmento de vendas',
C.GRIFFE 'Marca',
@brunossn
brunossn / HttpClientExtensions.cs
Created August 13, 2018 15:37
HttpClient extension to send PATCH
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
public static class HttpClientExtensions
{
public static async Task<HttpResponseMessage> PatchAsync(this HttpClient client, Uri requestUri, HttpContent content)
{
@brunossn
brunossn / ImageFromUrl.ts
Last active August 7, 2018 01:53
A async function in TypeScript to convert an url to a HTMLImageElement
// Example:
// const catImage = await ImageFromUrl('./img/cat.png');
async function ImageFromUrl(urlImage: string): Promise<HTMLImageElement> {
return new Promise<HTMLImageElement>(resolve => {
let base = new Image();
base.src = urlImage;
base.onload = function() {
resolve(base);
@brunossn
brunossn / PostComment.vue
Created July 20, 2018 15:29
A comment post vue component
<template>
<div class="wrapper" :class="classNivel">
<div class="container">
<img :src="urlFoto" />
<div class="comentario">
<div class="topo">
<a :href="urlPerfil" class="autor">{{ autor }}</a> -
<span class="tempo">{{ tempo }}</span>
</div>
<div>{{ texto }}</div>
@brunossn
brunossn / HexToBrushExtension.cs
Last active July 16, 2018 17:55
Convert a hexadecimal color string to SolidColorBrush in C#
// Example of usage:
// var color = "#FF0000".ToBrush();
public static class HexToBrushExtension
{
public static SolidColorBrush ToBrush(this string value)
{
var converter = new BrushConverter();
return (SolidColorBrush)converter.ConvertFromString(value);
}
@brunossn
brunossn / DownloadSavePage.fs
Created June 2, 2018 01:32
Download a webpage and save in disk in F#
open System.Net
open System.IO
let download (url: string) =
use wc = new WebClient()
wc.DownloadString(url)
let saveOnDisk fileName text =
File.WriteAllText(fileName, text)

Instagram PHP API

How to use

This a working example based on the previous posted workflow.
Feedback is as always welcome.

Original project repository: Instagram-PHP-API

index.php file