Skip to content

Instantly share code, notes, and snippets.

View alefranz's full-sized avatar
😍
.NET

Alessio Franceschelli alefranz

😍
.NET
View GitHub Profile
@alefranz
alefranz / goutte_examples.php
Created December 16, 2011 14:06
Goutte scraper example
<?php
// https://github.com/fabpot/Goutte
//Click on links:
$link = $crawler->selectLink('Plugins')->link();
$crawler = $client->click($link);
//Submit forms:
$form = $crawler->selectButton('sign in')->form();
$crawler = $client->submit($form, array('signin[username]' => 'fabien', 'signin[password]' => 'xxxxxx'));
@alefranz
alefranz / dabblet.css
Created December 21, 2011 14:03
Homepage
/**
* Homepage
*/
body {
background: #eef;
background: linear-gradient(45deg, #ccd, #eef);
min-height:100%;
}
h1 {
name: Build
on:
push:
branches: master
tags: '**'
pull_request:
jobs:
build:
@alefranz
alefranz / ThrowAsync.cs
Created May 26, 2020 19:53
An example of the difference between throw and Task.FromException
using System;
using System.Threading.Tasks;
using Xunit;
namespace ThrowAsync
{
public class ThrowAsyncTest
{
[Fact]
public async Task Behaviour()
Given an input of a collection of positive integers - values - and a number k - return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Additional Notes:
values can contain zero or more items.
values can have repeated numbers of the same value.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>
<PropertyGroup>
<DebugType>embedded</DebugType>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
</PropertyGroup>
@alefranz
alefranz / restart-streamdeck.cmd
Last active April 12, 2023 17:51
Restart StreamDeck
@echo off
cls
echo Waiting for Stream Deck to terminate...
:kill
taskkill /im StreamDeck.exe >NUL 2>NUL
timeout /T 3 >NUL
tasklist /FI "ImageName eq StreamDeck.exe" /NH | find /i "StreamDeck.exe" >NUL && goto kill