Skip to content

Instantly share code, notes, and snippets.

View wescleymatos's full-sized avatar
:octocat:
I'm ready!

Wescley Matos wescleymatos

:octocat:
I'm ready!
View GitHub Profile
const express = require('express')
const app = express()
const port = 3000
app.get('/somar', (request, response) => {
let soma = (parseInt(request.query.num1) + parseInt(request.query.num2))
response.end(`A soma é ${soma}`);
});
const fs = require('fs')
const path = './'
function readdirPromise(path) {
return new Promise((resolve, reject) => {
fs.readdir(path, (err, files) => {
if (err) {
reject(err);
} else {
resolve(files);
const fs = require('fs')
const path = './'
function readdirPromise(path) {
return new Promise((resolve, reject) => {
fs.readdir(path, (err, files) => {
if (err) {
reject(err);
} else {
resolve(files);
const fs = require('fs')
const path = './'
function readdirPromise(path) {
return new Promise((resolve, reject) => {
fs.readdir(path, (err, files) => {
if (err) {
reject(err);
} else {
resolve(files);
const produtos = [
{
id: 1,
preco: 10.0,
qtd: 2
},
{
id: 2,
preco: 10.0,
qtd: 2
const produtos = [
{
nome: 'Bicicleta',
preco: 1200.0
},
{
nome: 'Capacete',
preco: 450.0
}
]
@wescleymatos
wescleymatos / Gruntfile.js
Created May 31, 2017 02:44
Configuração do arquivo do grunt
module.exports = function(grunt) {
grunt.initConfig({
clean: {
temp: [
'public/js/app.js',
'public/js/libs.js'
],
all: [
'public/js/*.js'
@wescleymatos
wescleymatos / send-ajax.js
Last active April 19, 2017 14:28
Send ajax jquery with some content-type
// multpart/data
$('form').on('submit', function (e) {
e.preventDefault();
var form = new FormData($(this)[0]);
$.ajax({
method: "POST",
url: URL,
data: form,
processData: false,
contentType: false,
public IQueryable<AlunoDto> BuscarTodosAlunoDtos()
{
var alunos = (
from al in _context.Alunos
join pe in _context.Pessoas on al.Id equals pe.Id
into alu
from alun in alu.DefaultIfEmpty()
join at in _context.AlunoTurmas on al.Id equals at.AlunoId into alt
from ats in alt.DefaultIfEmpty()
@wescleymatos
wescleymatos / composicao.cs
Created September 13, 2016 19:16
dúvida composição
namespace Dominio {
public class Aluno
{
public Aluno( string nome, string matricula, string sexo, DateTime dataNascimento, string cpf, string corRaca, string email)
{
Nome = nome;
Matricula = matricula;
DataNascimento = dataNascimento;
Cpf = cpf;