Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mike Boutin DWboutin

🎯
Focusing
  • Quebec city
View GitHub Profile
@DWboutin
DWboutin / Apollo-server.ts
Created Nov 8, 2022
Apollo-server base file for tutorial
View Apollo-server.ts
import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone'
// The GraphQL schema
const typeDefs = `#graphql
type Query {
hello: String
}
`
@DWboutin
DWboutin / jestMockFsTyypescript.ts
Created Oct 17, 2022
Typescript Jest mock FS correctly
View jestMockFsTyypescript.ts
jest.mock('fs')
import fs from 'fs'
const mockedFs = fs as jest.Mocked<typeof fs>
describe('fetch', () => {
describe('file exists', () => {
beforeEach(() => {
mockedFs.existsSync.mockImplementation(() => true)
@DWboutin
DWboutin / merged.yml
Created Oct 14, 2022
GH Actions when pull request is merged in main
View merged.yml
name: Merged
on:
pull_request:
branches: [main]
types:
- closed
jobs:
is_merged:
View conversion.html
<!DOCTYPE html">
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>Exercice Sommatif 2</title>
</head>
<body>
@DWboutin
DWboutin / automatic-join-queue.js
Last active May 5, 2020
Turnip.exchange automatic join queue
View automatic-join-queue.js
var int = setInterval(function() {
var yourName = "Polle"
var button = document.querySelector('#app > div.view.bg-background.bg-center.col-start-2 > div.grid.gap-2 > div > button')
if(button.disabled === false) {
clearInterval(int)
button.click()
window.focus()
setTimeout(function() {
View gist:03e60c46ec8b31a83d26fdef76ec7d10
import React from 'react';
import { connect } from 'react-redux';
import { Responsive, WidthProvider } from 'react-grid-layout';
import { changeLayout, changeCurrentBreakpoint, changeWidgetOptions } from '../../actions/dashboard-actions';
import { fetch as fetchLayouts, create as createLayout } from '../../actions/layouts-actions';
import { fetch as fetchChartTypes } from '../../actions/chart-types-actions';
import {
fetch as fetchWidgets,
create as createWidget,
@DWboutin
DWboutin / angular-react-wrapper.ts
Created Sep 25, 2019
A minimalist wrapper to integrate React components in Angular with Angular-React
View angular-react-wrapper.ts
import { ReactWrapperComponent } from '@angular-react/core'
import {
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
NgZone,
OnInit,
Output,
View Col.js
import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import omit from 'omit.js'
class Col extends React.Component {
colClasses(col, size) {
const classes = {}
classes[`col-${size}-${col.span}`] = col.span
@DWboutin
DWboutin / directUploadToS3.js
Created Mar 31, 2019
Direct image url to S3 wiht axios and nodejs
View directUploadToS3.js
import AWS from 'aws-sdk';
import stream from 'stream'
import axios from 'axios';
export default async (url, filename, callback) => {
const s3 = new AWS.S3({ params: { Bucket: process.env.STATIC_MAPS_BUCKET }});
let contentType = 'application/octet-stream'
let promise = null
const uploadStream = () => {
@DWboutin
DWboutin / no-zoom.css
Created Mar 15, 2019
Remove zoom on IOS input focus
View no-zoom.css
@media screen and (-webkit-min-device-pixel-ratio:0) {
input[type="email"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="text"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover{font-size: initial;}