Skip to content

Instantly share code, notes, and snippets.

View ValentinH's full-sized avatar

Valentin Hervieu ValentinH

View GitHub Profile
@ValentinH
ValentinH / examples.test.ts
Last active March 11, 2023 21:59
mockGQLResolver is a wrapper around MSW to mock any GQL operations
import { mockGQLResolver } from './mockGQLResolver';
describe('mockGQLResolver demo', () => {
it('mocking a query with a plain object', async () => {
mockGQLResolver({
queries: {
ExampleQueryName: {
users: [
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
browse('https://meet.new')
let count = 1
let tab = ''
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
async function sleep(time = 1000) {
return new Promise(resolve => setTimeout(resolve, time))
}
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
async function sleep(time = 1000) {
return new Promise(resolve => setTimeout(resolve, time))
}
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
async function sleep(time = 1000) {
return new Promise(resolve => setTimeout(resolve, time))
}
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
async function sleep(time = 1000) {
return new Promise(resolve => setTimeout(resolve, time))
}
// Menu: Meet
// Description: Start new meet and paste on Slack
// Author: Valentin Hervieu
// Twitter: @ValentinHervieu
import "@johnlindquist/kit"
async function sleep(time = 1000) {
return new Promise(resolve => setTimeout(resolve, time))
}
@ValentinH
ValentinH / queryTwitter.php
Created January 5, 2014 10:35
How to query Twitter search API in PHP. This example shows how to query a hashtag and get the top 100 more recent results. * require CURL.
function queryTwitter($search)
{
$url = "https://api.twitter.com/1.1/search/tweets.json";
if($search != "")
$search = "#".$search;
$query = array( 'count' => 100, 'q' => urlencode($search), "result_type" => "recent");
$oauth_access_token = "ABCD";
$oauth_access_token_secret = "1234";
$consumer_key = "abcd";
$consumer_secret = "5678";
@ValentinH
ValentinH / named import VSCode snippet
Created January 2, 2021 13:54
VSCode snippet for named-import snippet
{
"Named import": {
"prefix": "ni",
"body": [
"import {$2} from '$1'"
],
"description": "Named import"
}
}
function decryptBigIpCookie(cookieValue) {
const [ipPart, portPart] = cookieValue.split('.')
const hexIp = parseInt(ipPart, 10)
.toString(16)
.padStart(8, '0')
const ip1 = parseInt(hexIp.toString().substring(6, 8), 16)
const ip2 = parseInt(hexIp.toString().substring(4, 6), 16)
const ip3 = parseInt(hexIp.toString().substring(2, 4), 16)
const ip4 = parseInt(hexIp.toString().substring(0, 2), 16)