Skip to content

Instantly share code, notes, and snippets.

View simoneb's full-sized avatar

Simone Busoli simoneb

View GitHub Profile
@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!
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 App() {
const response = useAxios('{your http api}')
return (
<pre>{JSON.stringify(response.data)}</pre>
)
}
function useAxios(url) {
const [response, setResponse] = React.useState()
React.useEffect(() => {
axios(url)
.then(response => setResponse(response))
.catch(error => setResponse(error))
}, [url])
return response
@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 / install-teamcity.md
Last active July 18, 2022 15:18 — forked from sandcastle/install-teamcity.md
Install TeamCity on Ubuntu with Nginx
@simoneb
simoneb / repro.js
Last active February 15, 2016 22:42
repro
let stream;
let events = ['message', 'tweet', 'delete', 'limit', 'scrub_geo', 'disconnect',
'connect', 'connected', 'reconnect', 'warning', 'status_withheld',
'user_withheld', 'friends', 'direct_message', 'user_event'];
function start(path, params) {
if (stream) stream.stop();
let T = new Twit({
@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;
DQuid IO - OAuth2 - Implementation
===================
This document contains a guide to implement an OAuth2 client for DQuid IO's services.
## A brief overview of OAuth2
### Access Tokens
APIs protected via OAuth2 require what is known as an **access token** to be accessed. An access token allows to implement a form of HTTP authentication which requires the token to be sent **alongside every request**, most commonly in the **authorization** header of the HTTP request: