Skip to content

Instantly share code, notes, and snippets.

View neomadara's full-sized avatar
🏠
Working from home

Cristian Gutiérrez neomadara

🏠
Working from home
View GitHub Profile
@neomadara
neomadara / ruby_setup.md
Created October 30, 2015 05:05 — forked from julionc/ruby_setup.md
Deploy Ruby On Rails on Ubuntu 14.04

Deploy Ruby On Rails on Ubuntu 14.04

Server: Nginx with Phusion Passenger

Ruby Version: 2.1.3

User System: deploy

User System

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
@neomadara
neomadara / doctors.js
Created January 11, 2016 16:55 — forked from elijahmanor/doctors.js
Reducing Filter and Map with Reduce
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 },
@neomadara
neomadara / up.js
Created January 25, 2016 01:58 — forked from joemccann/up.js
upload express example
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
@neomadara
neomadara / file.jade
Created January 25, 2016 02:52 — forked from kparkov/upload.jade
Multer uploads
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")
@neomadara
neomadara / rubyup.md
Created February 22, 2016 13:45 — forked from denpatin/rubyup.md
Ruby hacks

Smart hacks for Ruby

Interpolate arrays

pets = %w[dog cat rabbit]
puts "My first pet is a %s, my second one a %s and my third is a %s" % pets
@neomadara
neomadara / Passport.js
Created March 16, 2016 02:21 — forked from Thingyiot/Passport.js
Passport gist
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;
@neomadara
neomadara / server.js
Created March 16, 2016 02:21 — forked from reecer/server.js
PassportJS Usage
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());
@neomadara
neomadara / server.php
Created May 20, 2016 15:28 — forked from pawitp/server.php
Example for array/struct with nuSOAP
<?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) {
@neomadara
neomadara / public-app.js
Last active May 23, 2016 17:12 — forked from jrmoran/public-app.js
AngularJS and Express, rendering ejs-locals partials
var app = angular.module('app', ['ngResource']);
app.config(function($locationProvider, $routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', { templateUrl: 'partials/index', controller: 'ctrl' })
.when('/about', { templateUrl: 'partials/about', controller: 'ctrl' })
.otherwise({redirectTo:'/'});
});