Skip to content

Instantly share code, notes, and snippets.

View hc3's full-sized avatar
🎯
Focusing

Eliel hc3

🎯
Focusing
View GitHub Profile
@firxworx
firxworx / app.e2e-spec.ts
Created June 29, 2020 16:24
NestJS Integration/E2E Testing Example with TypeORM, Postgres, JWT
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication, LoggerService } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
class TestLogger implements LoggerService {
log(message: string) {}
error(message: string, trace: string) {}
warn(message: string) {}
debug(message: string) {}
@prateekkathal
prateekkathal / data.ts
Created August 14, 2019 14:50
Seeding Databases Using NestJS
export const languages: ILanguage[] = [
{ name: 'English' },
{ name: 'French' },
{ name: 'Spanish' },
{ name: 'Russian' },
// ... and others ...
];
@cecilemuller
cecilemuller / launch.json
Last active May 16, 2024 16:38
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@aelkz
aelkz / [FEDORA] gitkraken
Last active November 14, 2023 05:50
How to install gitkraken on Fedora [25,26,27] + launcher icon
#!/bin/bash
# Download GitKraken
wget https://release.gitkraken.com/linux/gitkraken-amd64.tar.gz
# copy the downloaded file into /opt directory
cp gitkraken-amd64.tar.gz /opt/
cd /opt
@olegon
olegon / mergesort.c
Last active September 23, 2023 14:53
Algoritmo Mergesort feito na linguagem C.
#include <stdio.h>
#include <stdlib.h>
void mergesort(int *v, int n);
void sort(int *v, int *c, int i, int f);
void merge(int *v, int *c, int i, int m, int f);
int main (void) {
int i;
int v[8] = { -1, 7, -3, 11, 4, -2, 4, 8 };

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@bq1990
bq1990 / gist:595c615970250e97f3ea
Created December 17, 2014 15:55
Supertest authenticate with bearer token
'use strict';
var should = require('should');
var app = require('../../app');
var request = require('supertest')(app);
describe('GET /api/incidents', function() {
it('should require authorization', function(done) {
request
@pasupulaphani
pasupulaphani / after_res_hooks.js
Last active May 1, 2024 20:37
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
@bavey
bavey / gist:8713170
Last active April 8, 2019 08:27
Resolving Heroku/Git push deployment errors.

This is how to resolve the following command line error message when pushing your app to Heroku:

~/Desktop/appname git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
fatal: 'heroku' does not appear to be a git repository
Please make sure you have the correct access rights and the repository exists.

The above error message appears because there's no remote named heroku. When you do a heroku create, if the git remote doesn't already exist, Heroku automatically creates one assuming you're in a git repo.

@cgiovanii
cgiovanii / laravel_migration_tutorial.md
Last active September 1, 2018 23:24
laravel: Comandos migrate do artisan para criar tabelas

Criar tabelas com o artisan:migrate

php artisan migrate:make create_filmes_table --table=filmes --create

/app/database/migrations/xxx_create_filmes_table.php
<?php

use Illuminate\Database\Schema\Blueprint;