Skip to content

Instantly share code, notes, and snippets.

View manudevcode's full-sized avatar
🏠
Working from home

Manuel García manudevcode

🏠
Working from home
View GitHub Profile
@manudevcode
manudevcode / vs-code-nestjs-snippets.json
Created May 4, 2021 05:07
Simple NestJS snippets for vs code
{
"Nest Cron": {
"prefix": "nestcron",
"body": "import { Injectable, Logger } from '@nestjs/common';\nimport { Cron } from '@nestjs/schedule';\n\n@Injectable()\nexport class ${1:Name}Service {\n\tprivate readonly logger = new Logger(${1:Name}Service.name);\n\n\t@Cron('45 * * * * *')\n\thandleCron() {\n\t\tconsole.log('Called when the current second is 45');\n\t}\n}",
"description": "Create new task class with cron method for NestJS"
},
"Nest MongoDB Model": {
"prefix": "nestschema",
"body": "import { Prop, Schema, SchemaFactoryx} from '@nestjs/mongoose';\nimport { Document } from 'mongoose';\n\nexport type ${1:param}Document = ${1:param} & Document;\n@Schema({\n \t// timestamp: true\n})\nexport class ${1:param} {\n\t@Prop()\n\tpropName: string;\n\n\t// More props here\n}\n\nexport const ${1:param}Schema = SchemaFactory.createForClass(${1:param});\n",
"description": "Create new mongodb shcema for NestJS"
@manudevcode
manudevcode / SocketContext.js
Created November 20, 2020 18:34 — forked from Klerith/SocketContext.js
Todo lo necesario para conectarnos a nuestro socket server - SocketContext, SocketProvider, useSocket
import React from 'react';
import { createContext } from 'react';
import { useSocket } from '../hooks/useSocket'
export const SocketContext = createContext();
export const SocketProvider = ({ children }) => {
const { socket, online } = useSocket('http://localhost:8080');
function binarySearch(value, list) {
let first = 0;
let last = list.length - 1;
let position = -1;
let found = false;
let middle;
while (found === false && first <= last) {
middle = Math.floor((first + last)/2);
if (list[middle] == value) {
@manudevcode
manudevcode / s3_public_policy.json
Created September 10, 2020 21:22
S3 Public policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublicReadAccess",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
import 'dart:collection';
import 'package:flutter/material.dart';
class Item {
final String id;
String listId;
final String title;
Item({this.id, this.listId, this.title});
}
const Alexa = require('ask-sdk')
const admin = require('firebase-admin')
var serviceAccount = require('./testing-iot-19f5e-firebase-adminsdk-oj631-6d9d70e282.json')
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://testing-iot-19f5e.firebaseio.com'
})
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Login Example',
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
@manudevcode
manudevcode / settings.json
Last active August 2, 2023 18:10
My favorite configuration for the vs code is simple or novice, but I like it.
// Install the folowing plugins
// Flutter and Flutter Snippets
// Carbon or Polacode
// Waka Time for productivity track
// Turbo Console Log
// ES7 React/Redux/GraphQL/React-Native snippets
// Material Theme
// Numbered Bookmarks
// Error Lens
// Git Lens