0% found this document useful (0 votes)
75 views4 pages

For Anki

The document contains code snippets and short explanations on various programming topics including: 1. Functions to prevent numbers and characters from being entered in inputs in JavaScript. 2. Combining two strings in JavaScript using the concat method. 3. Using the change event handler in Vue. 4. Comparing two strings and extracting differences with regex in JavaScript. 5. Validating fields in Vue using regular expressions. 6. Removing underscores from strings with replace in JavaScript. 7. Converting strings to sentence case in JavaScript. 8. Common errors like missing slashes in URLs and invalid NavMeshes in Unity. 9. Importing namespaces like List in C#

Uploaded by

Valentina Azocar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views4 pages

For Anki

The document contains code snippets and short explanations on various programming topics including: 1. Functions to prevent numbers and characters from being entered in inputs in JavaScript. 2. Combining two strings in JavaScript using the concat method. 3. Using the change event handler in Vue. 4. Comparing two strings and extracting differences with regex in JavaScript. 5. Validating fields in Vue using regular expressions. 6. Removing underscores from strings with replace in JavaScript. 7. Converting strings to sentence case in JavaScript. 8. Common errors like missing slashes in URLs and invalid NavMeshes in Unity. 9. Importing namespaces like List in C#

Uploaded by

Valentina Azocar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

prevenir numeros o letras en los input #code

function preventNumbers(e){
var numCode = (e.keyCode ? e.keyCode : e.which);
if (numCode > 47 && numCode < 58 || numCode > 95 && numCode < 107 ){
e.preventDefault();
}
}

function preventChar(e){
var charCode = (e.keyCode ? e.keyCode : e.which);
if (charCode > 31 && (charCode < 48 || charCode > 57)){
e.preventDefault();
}
}

$(document).ready(function(){
$('#id_nombre, #id_apellido').keypress(function(e) {
preventNumbers(e);
});
$('#id_telefono').keypress(function(e) {
preventChar(e);
});
})
----
megr two strings in js

var str1 = "Hello ";


var str2 = "world!";
var res = str1.concat(str2);
Try it Yourself » #learn #js

.......

onChange vue
<input v-model="userName" @change="someHandler"> #learn #vue

-----

Finding the difference between two string in Javascript with regex

var parentCode = this.parentData.codigo


var childCode = this.cuentaModel.codigo
getChildCode = (string, diffBy) => string.split(diffBy).join('')
var C = getChildCode(childCode, parentCode) #learn #js

:state= "validacionCodigo"

validacionCodigo(){
const value = this.localData.codigo
return !!value && /^\d+$/.test(value)
},

&& /^\d+$/.test(value) //checks if only number #learn #vue


return !!value // returns true if value false. can come in handy when validating
true=error when there is a null field(is false) #learn #js

Use .replace(/_/g, "") to remove all underscores or use .replace(/_/g, " ") to
replace them with a space.

Here is an example to remove them:

var str = "Yeah_so_many_underscores here";


var newStr = str.replace(/_/g, "");
alert(newStr); #learn #js

sentence case
text: e.charAt(0).toUpperCase() + e.substr(1).toLowerCase() #learn #js

error 301 Moved Permanently. falta el slash al final de la uri

Failed to create agent because there is no valid NavMesh

The technical answer is, because your GameObject with the NavMeshAgent component
isn't in contact with a NavMesh. That answer is about as helpful as referring
someone to the docs. (you know who you are)
Long story short, you need these things:
1. A NavMesh.
You bake these in your Terrain.
(Click on the GameObject Terrain, and look in the Navigation tab which isn't
viewable by default.)
2. A NavMeshAgent, which you clearly have, because it's generating the error.
Make sure the NavMeshAgent is touching the NavMesh when your game starts.
(IF it's touching, and you're still getting the error, try waiting a second or two
before enabling this GameObject. I've had this fix issues for me in the past. Seems
like the NavMesh takes a little longer to establish itself than the NavMeshAgent.
Then it's dogs, and cats living together.) #learn #unity

The type or namespace name `List' could not be found. Are you missing a using
directive or an assembly reference?

using UnityEngine;
using System.Collections;
using System.Collections.Generic; #learn #unity

watch:{
'item.someOtherProp'(newVal){
//to work with changes in "myArray"
},
'item.prop'(newVal){
//to work with changes in prop
}
}

wathc nested properties vue

#learn #vue

You might also like