viernes, 13 de junio de 2014
Instalar smartgit en ubuntu
1993 sudo add-apt-repository ppa:eugenesan/ppa
1994 sudo apt-get update
1995 sudo apt-get install smartgit
1996 sudo apt-get install smartgithg
viernes, 6 de junio de 2014
Uso de GIT y github
Instalar GIT
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
Separar la logica de la aplicacion con templates
var source =$("#song-template").html();
undefined
source
"
<span>
{{name}} - {{author}}
</span>
<span class="right">
<a href="" class="action icon-add gray"></a>
<a href="" class="action icon-love gray"></a>
<a href="" class="action icon-share gray"></a>
</span>
"
var template = Handlebars.compile(source);
undefined
var song = new Sfotipy.Song ({ name:"Marinlyn Monroe", author : "Pharell Williams" });
undefined
song.toJSON();
Object {name: "Marinlyn Monroe", author: "Pharell Williams"}
var html = template(song.toJSON());
undefined
var song = new Sfotipy.Song ({ name:"Thuder", author : "ACDC" });
undefined
var song1 = new Sfotipy.Song ({ name:"One", author : "Metallica" });
undefined
var songs = new Sfotipy.Songs([song, song1]);
undefined
songs
child {length: 2, models: Array[2], _byId: Object, constructor: function, model: function…}
songs.at(0);
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
songs.at(0).toJSIN();
TypeError: undefined is not a function
songs.at(0).toJSoN();
TypeError: undefined is not a function
songs.at(0).toJSON();
Object {name: "Thuder", author: "ACDC"}
songs.at(1).toJSON();
Object {name: "One", author: "Metallica"}
song.forEach(function(s){console.log(s.toJSON());});
TypeError: undefined is not a function
songs.forEach(function(s){console.log(s.toJSON());});
Object {name: "Thuder", author: "ACDC"} VM6044:2
Object {name: "One", author: "Metallica"} VM6044:2
[
,
]
child
child
songs.where({name: "One"});
var song = new Sfotipy.Song ({ name:"Thuder", author : "ACDC" });
undefined
var songView = new Sfotipy.SongView({ model: song, el: $(".list")});
undefined
songView.render();
undefined
song.set({name: "Marilyn Monroe", author:"Pharrell Williams"});
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
jueves, 5 de junio de 2014
main.js
Sfotipy = {};
Sfotipy.Song = Backbone.Model.extend({});
Sfotipy.SongView = Backbone.View.extend({
tagName: 'li',
className: 'item border-bottom',
render: function(){
var song =this.model;
var name =song.get('name');
var author = song.get('author');
this.$el.html("<span>" + author + "</span - <span>" + name + "</span>");
}
});
window.Sfotipy = Sfotipy;
Sfotipy.Song = Backbone.Model.extend({});
Sfotipy.SongView = Backbone.View.extend({
tagName: 'li',
className: 'item border-bottom',
render: function(){
var song =this.model;
var name =song.get('name');
var author = song.get('author');
this.$el.html("<span>" + author + "</span - <span>" + name + "</span>");
}
});
window.Sfotipy = Sfotipy;
Vistas en Backbone.js
Crear una vista
var SongView = Backbone.View.extend({ tagName: 'li', className:'item border-bottom', id:'song1'});
undefined
var view= new SongView();
undefined
view.el
- <li id="song1" class="item border-bottom"></li>
Modelos Backbone.js
Para empezar con backbone.js
Necesitamos descargar las librerias
http://backbonejs.org/
http://underscorejs.org/
http://jquery.com/download/
hay que agregar la librerias
<script src="lib/underscore.js"></script>
<script src="lib/jquery-1.11.0.js"></script>
<script src="lib/backbone.js"></script>
Para crear el model
var Song = Backbone.Model.extend({});
Instancear el modelo
var song = new Song({ name:"Fade to black", author:"Metallica"});
song.get("author")
Crear un evento
song.on("play2", function(){ console.log("reproduciendo ..")});
Ejecitar el evento
song.trigger("play2");
Evento change
Necesitamos descargar las librerias
http://backbonejs.org/
http://underscorejs.org/
http://jquery.com/download/
hay que agregar la librerias
<script src="lib/underscore.js"></script>
<script src="lib/jquery-1.11.0.js"></script>
<script src="lib/backbone.js"></script>
Para crear el model
var Song = Backbone.Model.extend({});
Instancear el modelo
var song = new Song({ name:"Fade to black", author:"Metallica"});
song.get("author")
Crear un evento
song.on("play2", function(){ console.log("reproduciendo ..")});
Ejecitar el evento
song.trigger("play2");
Evento change
song.on("change", function(){ console.log("He cambiado!!!!");});
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
song.toJSON();
Object {name: "Fade to black", author: "Metallica"}
song.set({ author: "Metallica2"});
2He cambiado!!!! VM702:2
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
song.set({ author: "Metallica"});
2He cambiado!!!! VM702:2
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
Suscribirse a:
Entradas (Atom)
