Skip to content

Instantly share code, notes, and snippets.

//botellas: Botella[] = [new Botella(100)]
var fullName = "Sergio Brito";
function setName(name: string): void {
this.fullName = name;
}
setName('Jhonnatan');
console.log(fullName);
@jjhoncv
jjhoncv / cleanCharacteresInvalidJs.md
Created April 5, 2017 16:06
clean Characters Invalid javascript

clean Characters Invalid javascript

dom.inputQuery.on("input", function() {
  this.value = this.value.replace(/[^0-9a-zA-Zñ -]/g, '');
});

$ mongoimport --db test --collection foo --drop --file results.json --jsonArray

importa todo el json a la bdd test en la collecion foo

Delete key duplicates

db.foo.ensureIndex({id:1}, {unique:true, dropDups:true})

Total de filas

db.foo.count()

@jjhoncv
jjhoncv / docker.md
Last active December 16, 2016 14:58
docker management

Access a created image of docker

docker run -ti fc7a6bffd438 /bin/sh

Build image docker

docker build -t micro-bower .
@jjhoncv
jjhoncv / changeVersionPHP.md
Created November 30, 2016 00:08
change version php 7.0 to 5.6

change version php 7.0 to 5.6

sudo apt-get remove -y --purge php

sudo add-apt-repository --remove ppa:ondrej/php

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

@jjhoncv
jjhoncv / tag.md
Last active November 29, 2016 16:37
create tag from branch

Create tag local

git tag -a v1.0 -m 'Mi versión v1.0'

Create tag prod

git push origin master --tags

Delete tag local

@jjhoncv
jjhoncv / converter.md
Last active November 15, 2016 16:18
create pdf from file php
sudo apt-get install wkhtmltopdf
php index.php > index.html && wkhtmltopdf index.html index.pdf && gnome-open index.pdf && rm -fr index.html
@jjhoncv
jjhoncv / deploy.md
Last active November 2, 2016 15:54
deploy from local to server

deploy from local to server

Create bare file from repository in server

~/bare && git init --bare nombre_de_tu_proyecto.git

Create repository local from bare file sever

~/htdocs && git clone USER@IP_SERVER:/home/USER/bare/nombre_de_tu_proyecto.git
@jjhoncv
jjhoncv / shourtcot.md
Last active August 29, 2016 20:44
shortcut vim

Format JSON in vim

:%!python -m json.tool
@jjhoncv
jjhoncv / node.md
Last active November 5, 2018 20:41
gulp without using sudo
  • remove sudo npm install
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
  • dependences globals node
npm -g ls --depth=0