This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SomeRequired<T , TRequired extends keyof T> = T & Required<Pick<T,TRequired>> | |
//example | |
type TmpUser = { | |
photo?: string, | |
username?: string | |
} | |
type User = SomeRequired<TmpUser, 'username'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import canvas, { CANVAS_H, CANVAS_W } from "./canvas"; | |
import Engine from "./engine"; | |
import Button from "./entities/button"; | |
import TouchSystem from "./systems/touch-system"; | |
import { Images } from "./types"; | |
import Client from "./socket-client"; | |
import Counter from "./entities/counter"; | |
import CounterSystem from "./systems/counter-system"; | |
const BASE_URL = window.location.protocol + '//' + window.location.host; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handler=()=>{ | |
console.log("hello") | |
} | |
// call the handler function every 2sec | |
let stopper = setInterval(handler, 2000) | |
// stop the setInterval method | |
clearInterval(stopper) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
"time" | |
) | |
// setInterval call p function every "interval" time | |
func setInterval(p interface{}, interval time.Duration) chan<- bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12.0-slim | |
COPY . . | |
RUN yarn install | |
RUN yarn build | |
RUN npm install -g serve | |
EXPOSE 8080 | |
CMD ["serve","-p","8080","build/"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<dir>./MyFontDirectory/</dir> | |
<cachedir>/tmp/fonts-cache/</cachedir> | |
<config></config> | |
</fontconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImageWatermark: | |
handler: ImageWatermark | |
events: | |
- s3: | |
existing: true | |
bucket: ${self:custom.configs.UPLOAD_BUCKET} | |
event: s3:ObjectCreated:* | |
rules: | |
- suffix: .jpg | |
- s3: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dependencies | |
const AWS = require("aws-sdk"); | |
const util = require("util"); | |
const sharp = require("sharp"); | |
// get reference to S3 client | |
const s3 = new AWS.S3(); | |
exports.compressImage = async (event, context) => { | |
// Read options from the event parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
------------------- | |
read more about this gist here: https://medium.com/@saphidev/analogread-and-the-interrupt-pins-f9c986d3fc0e | |
------------------- | |
*/ | |
#define LED 13 //optionel | |
#define BTN A5 //ADC5 | |
#define INTRPT 2 //PD2 refer to the INT0 vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const byte ledPin = 13; | |
const byte interruptPin = 2; | |
volatile byte state = LOW; | |
void setup() { | |
pinMode(ledPin, OUTPUT); | |
pinMode(interruptPin, INPUT_PULLUP); | |
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE); | |
} |
NewerOlder