pets = %w[dog cat rabbit]
puts "My first pet is a %s, my second one a %s and my third is a %s" % pets
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
| <?php | |
| date_default_timezone_set('Asia/Bangkok'); | |
| require_once "lib/nusoap.php"; | |
| // Create SOAP Server | |
| $server = new soap_server(); | |
| $server->configureWSDL("Test_Service", "http://www.example.com/test_service"); | |
| // Example "hello" function | |
| function hello($username) { |
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 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()); |
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') | |
| , 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; |
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
| 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") |
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
| 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 |
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 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 }, |
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 upNewerOlder