Skip to content

Instantly share code, notes, and snippets.

View dac09's full-sized avatar

Daniel Choudhury dac09

View GitHub Profile
export const comments: QueryResolvers['comments'] = async ({
parentType,
parentId,
}) => {
const commentable = parentType[0].toLowerCase() + parentType.substring(1)
validateWith(() => {
if (!Object.values(Commentable).includes(commentable)) {
throw new Error(
'Invalid commentable passed in, check your value for parentType'
@afpro
afpro / ios-codec.m
Created November 17, 2021 03:51
objc codec sample code
@import Foundation;
@import AVFoundation;
@import VideoToolbox;
@import AudioToolbox;
void videoCompressTest(void);
int main(int argc, const char * argv[]) {
@autoreleasepool {
videoCompressTest();
@aelbore
aelbore / esm-cjs-modules.md
Last active May 5, 2024 03:07
Publish your npm package as ES Module, and backward compatibility CommonJS

Create your library

  • Initialize project npm init -y
  • Create esm module ./src/esm/my-lib.js
    function addNumber(value, value2) {
      return value + value2;
    }
    
    export { addNumber };
@hgouveia
hgouveia / publisher.js
Last active December 2, 2020 11:13
electron-builder s3 publisher, to be able to triggered it manually reusing a preexisting file
'use strict';
// Alternative version
const { PublishManager } = require('app-builder-lib/out/publish/PublishManager');
const { normalizeOptions } = require('electron-builder/out/builder');
const { Packager } = require('app-builder-lib/out/packager');
const pkg = require('../package.json');
const argv = require('yargs').argv;
const buildFile = argv.file.replace('${version}', pkg.version);
const buildDir = argv.buildDir || './build/';
import UIKit
import AVFoundation
import Photos
import MobileCoreServices
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
startVideoToGIFProcess()
@Krisztiaan
Krisztiaan / extraTypes.d.ts
Last active February 12, 2020 14:56
Extra Typescript Types
type ValuesOf<T> = T extends { [key: string]: infer T } ? T : never
// type Parameters<T> = T extends (...args: infer T) => any ? T : never
type FirstParameter<T> = T extends (first: infer T, ...args: any) => any ? T : never
type SecondParameter<T> = T extends (first: any, second: infer T, ...args: any) => any ? T : never
type PromiseValue<T> = T extends Promise<infer U>
? U
: T extends (...args: any[]) => Promise<infer U>
? U
: T
type Require<T, P extends keyof T> = T & Required<Pick<T, P>>
@Surendrajat
Surendrajat / elementaryos.md
Last active December 2, 2021 21:16 — forked from suberb/elementaryos.md
elementaryOS | Things I Do After Installing elementary OS Hera

First Things First

  • Enable PPA

     sudo apt update
     sudo apt install software-properties-common apt-transport-https curl
  • Install apt-fast [Yes! it's really fast]

@bananafish911
bananafish911 / VideoConverter.swift
Created March 5, 2019 14:36
Video Converter Swift 4.2
// Created by Victor on 1/16/19.
// Copyright © 2019 tchop. All rights reserved.
//
// https://medium.com/samkirkiles/swift-using-avassetwriter-to-compress-video-files-for-network-transfer-4dcc7b4288c5
import Foundation
import AVFoundation
class VideoConverter {
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active December 20, 2023 16:50
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@suberb
suberb / elementaryos.md
Last active December 25, 2023 19:14
elementaryOS | Things To Do After Installing Elementary OS Loki [Best OS For Switching From Windows & Mac]

FIRST THING FIRST


  • Update OS
sudo apt-get update && sudo apt-get upgrade