This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class LimitarVuelo : MonoBehaviour | |
{ | |
private float xOff; | |
[Header("Separacion del sprite con el borde de la pantalla en X izquierda:")] | |
public float xOffsetLeft; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = 1160, | |
h = 700, | |
radius = Math.min(w, h) / 2; | |
var color = d3.scale.ordinal() | |
.range(["#DF9496","#A2ADBC","#F4F3EE", "#D9E2E1", "#2BBBD8","#D0E8F4"]); | |
//.range(["#3366CC","#F5F6CE","#F2F2F2","#00BFFF","#3366CC","#FF3300", "#CCFF33"]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 14px sans-serif; | |
} | |
.axis path, | |
.axis line { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/users/me/logout', auth, async (req, res) => { | |
try { | |
req.user.tokens = req.user.tokens.filter((token) => { | |
return token.token != req.token | |
}) | |
await req.user.save() | |
res.send() | |
} catch (error) { | |
res.status(500).send(error) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jwt = require('jsonwebtoken') | |
const User = require('../models/User') | |
const auth = async(req, res, next) => { | |
const token = req.header('Authorization').replace('Bearer ', '') | |
const data = jwt.verify(token, process.env.JWT_KEY) | |
try { | |
const user = await User.findOne({ _id: data._id, 'tokens.token': token }) | |
if (!user) { | |
throw new Error() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const User = require('../models/User') | |
const router = express.Router() | |
router.post('/users', async (req, res) => { | |
try { | |
const user = new User(req.body) | |
await user.save() | |
const token = await user.generateAuthToken() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose') | |
const validator = require('validator') | |
const bcrypt = require('bcryptjs') | |
const jwt = require('jsonwebtoken') | |
const userSchema = mongoose.Schema({ | |
name: { | |
type: String, | |
required: true, | |
trim: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var bcrypt = require('bcryptjs') | |
var userSchema = new mongoose.Schema({ | |
name: String, | |
email: {type:String,unique:true}, | |
password: String, | |
avatar:String | |
},{timestamps:true}) | |
userSchema.pre('save', next => { | |
var user = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.io.*; | |
public class TCPServer { | |
public static void main (String args[]) { | |
try{ | |
int serverPort = 7896; // the server port | |
ServerSocket listenSocket = new ServerSocket(serverPort); | |
while(true) { | |
Socket clientSocket = listenSocket.accept(); | |
Connection c = new Connection(clientSocket); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.io.*; | |
public class TCPClient { | |
public static void main (String args[]) { | |
// arguments supply message and hostname | |
Socket s = null; | |
try{ | |
int serverPort = 7896; | |
s = new Socket(args[1], serverPort); | |
DataInputStream in = new DataInputStream( s.getInputStream()); |
NewerOlder