Skip to content

Instantly share code, notes, and snippets.

View simoneb's full-sized avatar

Simone Busoli simoneb

View GitHub Profile
@simoneb
simoneb / install-teamcity.md
Last active July 18, 2022 15:18 — forked from sandcastle/install-teamcity.md
Install TeamCity on Ubuntu with Nginx
@simoneb
simoneb / example.ts
Last active June 7, 2021 08:36 — forked from 0x77dev/mercurius-issue-424.ts
mercurius-js/mercurius #424
const Fastify = require('fastify')
const mercurius = require('mercurius')
const example = Fastify()
const schema = `
extend type Query {
test: Boolean!
}
extend type Mutation {
addTestEvent(userId: Int!): Int!
@simoneb
simoneb / parser.cs
Last active January 7, 2020 07:34
Simple dynamic command line arguments parser
class Options : DynamicObject
{
readonly IDictionary<string, object> inner = new ExpandoObject();
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
if (!inner.TryGetValue(binder.Name, out result))
result = false;
else
result = result != null ? new OptionValue(result.ToString()) : (dynamic)true;
import myCustomTheme from '@my-custom-theme'
import { MyCustomFooter, MyCustomHomepage } from '@my-component-library'
export default {
// overriding theme
theme: myCustomTheme, // OR
theme: originalTheme => myCustomTheme,
// component presence
componentPresence: {
function useAxios(url) {
const [response, setResponse] = React.useState()
React.useEffect(() => {
axios(url)
.then(response => setResponse(response))
.catch(error => setResponse(error))
}, [url])
return response
function App() {
const response = useAxios('{your http api}')
return (
<pre>{JSON.stringify(response.data)}</pre>
)
}
@simoneb
simoneb / NAnt.exe.config
Created October 21, 2013 19:33
NAnt configuration file modified to support .NET 4.5
<?xml version="1.0"?>
<configuration>
<!-- Leave this alone. Sets up configsectionhandler section -->
<configSections>
<section name="nant" type="NAnt.Core.ConfigurationSection, NAnt.Core" />
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<appSettings>
<!-- Used to indicate the location of the cache folder for shadow files -->
<add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
@simoneb
simoneb / rle.js
Created September 13, 2015 23:30
Javascript RLE
var str = 'AAABCCDEEE';
var expected = '3A1B2C1D3E';
var result = _.reduce(str+'\0',(a,c,i,s)=>{if(i&&s[i-1]!== c){a.r+=a.c+s[i-1];a.c=1;}else{a.c++;}return a;},{c:0,r:''}).r
result === expected;
@simoneb
simoneb / dabblet.css
Created January 14, 2017 22:24
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
@simoneb
simoneb / linqpad-nunitlite.cs
Created October 29, 2012 00:42
NUnitLite in LINQPad
void Main()
{
new NUnitLite.Runner.TextUI().Execute(new[]{"-noheader"});
}
// Define other methods and classes here
[Test]
public void SomeTest()
{
Assert.Pass();