Server: Nginx with Phusion Passenger
Ruby Version: 2.1.3
User System: deploy
<%= stylesheet_link_tag "welcome" if controller_name == "welcome" %> |
Download and Install Vagrant http://www.vagrantup.com/ and VirtualBox https://www.virtualbox.org/ or VMware before beginning
#Set up Vagrant *this guide assumes the use of Mac OS X Mountain Lion on local machine and Ubuntu 12.04 LTS x64 on Vagrant box. It is compatible with many other distros but hasn't been tested.
##Step 1: Make and run box
vagrant init
vagrant box add <path to box directory or name according to https://vagrantcloud.com/>
vagrant up
var doctors = [ | |
{ number: 1, actor: "William Hartnell", begin: 1963, end: 1966 }, | |
{ number: 2, actor: "Patrick Troughton", begin: 1966, end: 1969 }, | |
{ number: 3, actor: "Jon Pertwee", begin: 1970, end: 1974 }, | |
{ number: 4, actor: "Tom Baker", begin: 1974, end: 1981 }, | |
{ number: 5, actor: "Peter Davison", begin: 1982, end: 1984 }, | |
{ number: 6, actor: "Colin Baker", begin: 1984, end: 1986 }, | |
{ number: 7, actor: "Sylvester McCoy", begin: 1987, end: 1989 }, | |
{ number: 8, actor: "Paul McGann", begin: 1996, end: 1996 }, | |
{ number: 9, actor: "Christopher Eccleston", begin: 2005, end: 2005 }, |
app.post('/upload/photo', function(req, res, next){ | |
var json_response = {} | |
req.form.complete(function (err, fields, files){ | |
if (err){ | |
next(err) | |
} | |
else{ | |
// temporary filename |
doctype html | |
html | |
head | |
title File uploads | |
body | |
form(method="post", action="/file", enctype="multipart/form-data") | |
input(type="file", name="file") | |
input(type="submit", value="Upload") |
var express = require('express') | |
, passport = require('passport') | |
, LocalStrategy = require('passport-local').Strategy | |
, mongodb = require('mongodb') | |
, mongoose = require('mongoose') | |
, bcrypt = require('bcrypt') | |
, SALT_WORK_FACTOR = 10; | |
mongoose.connect('localhost', 'test'); | |
var db = mongoose.connection; |
var passport = require('passport'), | |
FacebookStrategy = require('passport-facebook').Strategy, | |
TwitterStrategy = require('passport-twitter').Strategy, | |
GithubStrategy = require('passport-github').Strategy, | |
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy; | |
/* ...server setup... */ | |
// Setup passport auth | |
app.use(passport.initialize()); |
<?php | |
function encriptar($texto){ | |
$key='palabraclaveparalacodificacionydecodificacion'; // Una clave de codificacion, debe usarse la misma para encriptar y desencriptar | |
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $cadena, MCRYPT_MODE_CBC, md5(md5($key)))); | |
return $encrypted; | |
}; | |
function desencriptar($texto){ |