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
/[Ll]ibrary/ | |
/[Tt]emp/ | |
/[Oo]bj/ | |
/[Bb]uild/ | |
/[Bb]uilds/ | |
/[Ll]ogs/ | |
# Never ignore Asset meta data | |
!/[Aa]ssets/**/*.meta |
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> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello World</title> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<!-- Don't use this in production: --> | |
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> |
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 ObjectPool : MonoBehaviour | |
{ | |
[Header("Place here your objects to be spawned:")] | |
public GameObject[] objectsToSpawn; | |
private GameObject[] _objectsCollection; |
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; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PooledObject : MonoBehaviour | |
{ | |
public float speed; | |
public string limitTag; | |
private void OnTriggerEnter2D(Collider2D other) |
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()); |
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
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
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
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 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() |
OlderNewer