Skip to content

Instantly share code, notes, and snippets.

View aquiseb's full-sized avatar

Sébastien aquiseb

View GitHub Profile
@BrunoQuaresma
BrunoQuaresma / nextapimock.ts
Last active July 18, 2023 17:12
NextApiResponse and NextApiRequest mocks
import { IncomingMessage } from 'http'
import {
NextApiRequestCookies,
NextApiRequestQuery,
} from 'next/dist/next-server/server/api-utils'
import { Socket } from 'net'
import { ServerResponse } from 'http'
import { NextApiRequest, NextApiResponse } from 'next'
import { Env } from 'next/dist/lib/load-env-config'
Description: Web Application lambdas
Transform: AWS::Serverless-2016-10-31
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
Version:
Description: Version of this template
Type: String
EnvName:
Description: An environment name that is prefixed to resource names
Type: String
@miguelmota
miguelmota / crypto.go
Last active June 5, 2024 14:28
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]
@enriquebrgn
enriquebrgn / index.ts
Created November 6, 2018 16:54
Secure subscription stitching
import { from } from 'apollo-link'
import { HttpLink } from 'apollo-link-http';
import { setContext } from 'apollo-link-context';
import { split } from 'apollo-client-preset'
import { hasSubscription } from "@jumpn/utils-graphql";
import SocketLink from './socketLink';
import fetch from 'node-fetch';
import { introspectSchema, makeRemoteExecutableSchema } from 'graphql-tools';
import { GraphQLSchema } from "graphql";
@necolas
necolas / Composite-Link.js
Created September 19, 2018 23:02
Next.js links with React Native for Web
@cidicles
cidicles / fixed.js
Created November 27, 2017 18:22
Fixed Position Components for React VR
import React from 'react';
import {
VrHeadModel,
View
} from 'react-vr';
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
/**
* Helper to fix a component to the viewport.
* @module components/fixed
@fjordan
fjordan / App.js
Created November 12, 2017 20:56 — forked from shelldandy/App.js
nprogress with react-router in create-react-app
import React from 'react'
import { BrowserRouter as Router, Switch } from 'react-router-dom'
import routes from './routes'
import FancyRoute from './components/tools/FancyRoute'
const App = props =>
<Router>
<Switch>
{routes.map((route, i) =>
<FancyRoute key={i} {...route} />
@vishalsrini
vishalsrini / resize.js
Last active September 6, 2024 17:22
A simple JavaScript to resize an image and create a blob out of it
window.resize = (function () {
'use strict';
function Resize() {}
Resize.prototype = {
init: function(outputQuality) {
this.outputQuality = (outputQuality === 'undefined' ? 0.8 : outputQuality);
},
@aaangeletakis
aaangeletakis / How-To-Install-SDL-On-Ubuntu.md
Last active October 16, 2024 19:16
How do I install SDL on ubuntu?

What you need to do to install SDL is:

#install sdl2
sudo apt install libsdl2-dev libsdl2-2.0-0 -y;

#install sdl image  - if you want to display images
sudo apt install libjpeg-dev libwebp-dev libtiff5-dev libsdl2-image-dev libsdl2-image-2.0-0 -y;

#install sdl mixer  - if you want sound
@luisfarzati
luisfarzati / app.js
Created May 6, 2017 01:44
Node.js hot-reloading using Cluster
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.status(200)
.contentType('application/json')
.json({ hello: 'world' })
})