Skip to content

Instantly share code, notes, and snippets.

View manuerumx's full-sized avatar
:shipit:

Manuel González R manuerumx

:shipit:
View GitHub Profile
@manuerumx
manuerumx / game.js
Created March 6, 2019 14:39
Game of Life (Canvas + JS)
const sWidth = 800;
const sHeight = 400;
const resolution = 2;
let scenario = null;
let context = null;
let grid = null;
let cols = 0;
let rows = 0;
let iteration = 0;
@manuerumx
manuerumx / update.sh
Last active February 1, 2019 11:26
Update repositories in batch
#!/bin/sh
function printdash(){
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
}
function ini_update(){
REPO=${PWD##*/}
COLUMNS=$(tput cols)
printdash

MongoDB Replicaset with Vagrant

This will generate a 3 virtual machines running Debian/Jessie 64 bits with MongoDB 3.2

If you want to change the box to use another OS, you should change the script mongoInitScript which install MongoDB and configure it.

Requirements

@manuerumx
manuerumx / postJSON.cs
Last active October 20, 2021 05:39
Unity 3D example POST JSON Data to a Server with http Auth
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class goLevel : MonoBehaviour {
//With the @ before the string, we can split a long string in many lines without getting errors
private string json = @"{
'hello':'world',
'foo':'bar',
'count':25
@manuerumx
manuerumx / rubik.html
Created May 27, 2014 23:09
Rubik cube sample
<html>
<head>
<title>Rubik test</title>
<style>
table{border:1px solid #000; height: 100%}
td{text-align: center;
vertical-align: middle;}
</style>
</head>
<body>
@manuerumx
manuerumx / ObjectController.js
Last active August 29, 2015 14:01
Updating array document with MongooseJS and ExpressJS
var mongoose = require('mongoose');
var myDocument_schema = require('./ObjectModel');
var db_lnk = 'mongodb://localhost/mydatabase';
exports.Update = function (req, res, next){
var db = mongoose.createConnection(db_lnk);
var idDoc = req.param.id; //We get the ID param
var today = new Date();
var myDoc = db.model('MyDocuments',myDocument_schema);
myDoc.findById(idDoc, function(err, doc){
@manuerumx
manuerumx / config.php
Last active December 16, 2015 00:29
A simple way to store variables in a class
abstract class config{
protected $myconf = array();
abstract function getValue($key, $default="");
abstract function setValue($key, $value);
abstract function clearConfig();
}
@manuerumx
manuerumx / Boyer-Moore
Created March 15, 2013 16:03
VB6 Boyer-Moore implementation
Function Busca_Boyer_Moore(CadenaBuscar As String, CadenaBuscarEn As String, Optional Inicio As Double = 1) As Double
Dim x As Integer
Dim Y As Integer
Dim intPoscLC As Double
Dim intPoscFin As Double
Dim intLenCadBus As Double
Dim intLenCadBusE As Double
Dim strCaracter() As String
Dim blnMatch As Boolean