Skip to content

Instantly share code, notes, and snippets.

🦊
Focusing

gompro leejh3224

Block or report user

Report or block leejh3224

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View image_merger.py
import sys
import os
import fnmatch
from PIL import Image
imageSource = os.path.join(
"C:\\", "Users", "stern", "Google 드라이브", "기타", "Goodnotes4Export"
)
outputPath = os.path.join(
"C:\\", "Users", "stern", "Google 드라이브", "기타", "output"
View offline2.test.ts
it("should test `onUserCreate`", async () => {
const wrapped = testEnv.wrap(api.onUserCreate);
const testUser = {
uid: "122",
displayName: "lee"
};
await wrapped(testUser);
// generate user returns newUser object below
View offline1.test.ts
import functions from "firebase-functions-test";
import * as admin from "firebase-admin";
import { generateNewUser } from "../lib";
const testEnv = functions();
/**
* mock setup
*/
const mockSet = jest.fn();
View online2.test.ts
describe("my functions", () => {
let adminStub, api;
beforeAll(() => {
// you can use `sinon.stub` instead
adminStub = jest.spyOn(admin, "initializeApp");
// after initializeApp call, we load our functions
api = require("../index");
});
View online1.test.ts
import functions from "firebase-functions-test";
import * as admin from "firebase-admin";
import * as path from "path";
// you can check all these information in firebase console/settings
const projectConfig = {
projectId: "projectId",
databaseURL: "databaseURL"
};
View jest.config.js
// this config includes typescript specific settings
// and if you're not using typescript, you should remove `transform` property
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: 'src(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
testPathIgnorePatterns: ['lib/', 'node_modules/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testEnvironment: 'node',
View onUserCreate.ts
/**
* functions.auth.user().onCreate is triggered when
* 1. register via email/password
* 2. first logIn via 3rd party auth providers (Facebook, Google, etc)
* 3. developer creates new account via Firebase Admin SDK
* 4. first logIn as anonymousUser
*
* What this functions does is that when onCreate method is triggered,
* we create `newUser` with necessary information including uid or displayName from given user
* And then save it in our database
View Bellman-Ford-in-python3.py
# Bellman-Ford implementation from MIT 6006 course lesson #17
import math
import networkx as nx
# utility: Graph
class Graph:
def __init__(self, vertices):
self.V = vertices
self.edges = []
View dijkstra_in_python3.py
# dijkstra implementation from MIT 6006 course lesson #16
from collections import defaultdict
import math
from heapq import heapify, heappush, heappop
# utility: priority queue
class Pq:
def __init__(self):
self.queue = []
View pbkdf2-password.ts
import { pbkdf2, randomBytes } from 'crypto'
const iteration = 199999
const hashLength = 64
const digest = 'sha512'
// promisify native pbkdf2 function
const generateHash = (password: string, salt: string): Promise<string> => {
return new Promise((resolve, reject) => {
pbkdf2(password, salt, iteration, hashLength, digest, (err, key) => {
You can’t perform that action at this time.