This file contains hidden or 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
| def age(self): | |
| if hasattr(self, "_age"): | |
| return self._age | |
| today = datetime.date.today() | |
| age = today.year - self.birthdate.year | |
| if today < datetime.date(today.year, self.birthdate.month, self.birthdate.day): | |
| age -= 1 |
This file contains hidden or 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
| # coding: utf-8 | |
| import jwt | |
| from datetime import datetime | |
| from flask import Flask, jsonify, request | |
| app = Flask(__name__) | |
| key = 'foo' | |
| @app.before_request |
This file contains hidden or 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
| (function() { | |
| var script, | |
| scripts = document.getElementsByTagName('script')[0]; | |
| function load(url) { | |
| script = document.createElement('script'); | |
| script.async = true; | |
| script.src = url; | |
| scripts.parentNode.insertBefore(script, scripts); |
This file contains hidden or 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
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| respawn limit 10 5 | |
| setuid ubuntu | |
| chdir /opt/myAplicacion | |
| env PORT=3000 |
This file contains hidden or 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 app = angular.module('App', []); | |
| app.factory('Song', function($http, $q) { | |
| function Song() {} | |
| Song.getAverageSongPrice = function(artist) { | |
| var dfd = $q.defer(); | |
| $http.get('http://localhost:4000/artists/eminem/songs').then(function(resp) { | |
| var total = 0; |
This file contains hidden or 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
| describe('TestController', function () { | |
| var controller = null; | |
| $scope = null; | |
| beforeEach(function () { | |
| module('myApp'); | |
| }); | |
| beforeEach(inject(function ($controller, $rootScope) { |
This file contains hidden or 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 express = require('express'); | |
| var app = express(); | |
| app.use(express.static(__dirname + '/public')); | |
| var host = process.env.IP || '0.0.0.0', | |
| port = process.env.PORT || 3000; | |
| var server = app.listen(port, host, function() { | |
| console.log('Listening at http://%s:%s', host, port); |
This file contains hidden or 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
| vagrant init | |
| vagrant box add mi_caja_ubuntu_precise_32 http://files.vagrantup.com/precise32.box | |
| vagrant ssh // Access to the | |
| vagrant suspend // Move from RAM to disk | |
| vagrant resume // Retake virtual machine | |
| vagrant halt // Stop virtual machine | |
| vagrant destroy // Destroy virtual machine | |
| vagrant status // See current status of the virtual machine |
This file contains hidden or 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
| /** | |
| * Created by gaspar on 22/sept/15. | |
| */ | |
| //angularJS | |
| (function () { | |
| var app = angular.module('app', | |
| //ejemplo de algun controlador | |
| ['app.mainController'] | |
| ); |
This file contains hidden or 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
| /** | |
| * Este script de javascript permite trabajar transparentemente solicitudes que requieren | |
| * protección del token CSRF por medio de AJAX JQUERY. | |
| * Esto te permitirá hacer solcitudes a web Services de Django por medio de AJAX Jquery. | |
| * Para utilizarlo basta con integrar el archivo DjangoAjax.js en tu directorio de JS y hacer referencia a él en tus templates | |
| * que requieren del uso de AJAX por POST o algún otro que requiera el token CSRF. | |
| * Este script está basado en la documentación oficial de Django https://docs.djangoproject.com | |
| */ | |
| $(function(){ |