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 / routeCreator.js
Created September 7, 2016 15:29 — forked from jupazave/routeCreator.js
Mapa con ruta - store locator
var me = new Object();
var directionsService = new google.maps.DirectionsService();
var directionsDisplay;
function calcRoute() {
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(mapaGlobal);
@neomadara
neomadara / googlemaps.js
Created September 7, 2016 15:20
Google Maps API sample
// npm i google-maps
import GoogleMapsLoader from 'google-maps';
GoogleMapsLoader.KEY = 'AIzaSyA9aGnRJDU1DRIXl5urposeU0p6qXr0LWM';
GoogleMapsLoader.LIBRARIES = [
// ルート描画に必要
'places'
];
@neomadara
neomadara / index.html
Created September 7, 2016 15:01
GoogleMapでルート検索のオプションを実験
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
Model.find({}, [], {'group': 'FIELD'}, function(err, logs) {
// code
});
@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:'/'});
});
@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 / encriptar-desencriptar.php
Last active March 30, 2021 04:57
encriptar y desencriptar MD5
<?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){
@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 / 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 / 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