This file contains 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 ConstructorName = (function() { | |
'use strict'; | |
var variablePrivada = 0; | |
function ConstructorName(args) { | |
// enforces new | |
if (!(this instanceof ConstructorName)) { | |
return new ConstructorName(args); | |
} |
This file contains 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
//This uses mocha + should.js for running the unit tests | |
it('should allow players to take out a Pawn when a five(5/x) is rolled', function() { | |
//Since the dice throws random numnbers, we either need to throw it many times until | |
//we get the value we want, or just overwrite it's functionality. | |
//Here we chose to overwrite using the sinonJS mocking framework | |
sinon.stub(game, 'throwDices').returns([5,4]); | |
sinon.stub(game, 'lastDiceThrow').returns([5,4]); | |
game.enterPawn(0); |
This file contains 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
public void FichasRepartidasAJugadoresDebenSerBarajadas() | |
{ | |
var probabilidad = 1m/28m; | |
int cantidadCajitas = 0; | |
for (int i = 0; i < 100; i++) | |
{ | |
var juego = new JuegoDomino(); | |
if (juego.Jugadores[0].Fichas[0].Equals(new Ficha(0, 0))) | |
{ |
This file contains 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
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ChefOdd { class Program { static void Main(string[] args) { var qty = Convert.ToInt32(Console.ReadLine()); var testCases = new int[qty]; for (var i = 0; i < qty; i++) { var input = Convert.ToInt32(Console.ReadLine()); testCases[i] = input; } for (var i = 0; i < qty; i++) { GetBestPlace(testCases[i]); } Console.Read(); } private static void GetBestPlace(int testCase) { var initArray = Enumerable.Range(1, testCase).ToArray(); Console.WriteLine(DrawArray(initArray)); while (initArray.Length > 1) { var newArrSize = initArray.Length/2; var newArr = new int[newArrSize]; |
This file contains 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
{ | |
"@name": "WasteLands", | |
"@tilesPerRow": "50", | |
"@tilesPerColumn": "50", | |
"@PixelsPerTile": "60", | |
"tileType": [ | |
{ | |
"@name": "gold", | |
"@weight": "10" | |
}, |
This file contains 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
public static bool IsNullOrEmpty(string value) { if (value != null) return value.Length == 0; else return true; } |
This file contains 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
require 'rubygems' | |
require 'json' | |
require 'net/http' | |
require 'uri' | |
#HTTP Request Objects | |
uri = URI.parse('https://basecamp.com/1823619/api/v1/projects/320356/attachments.json') #ruta de subir attachments en Basecamp | |
@https = Net::HTTP.new(uri.host,uri.port) | |
@https.use_ssl = true |
This file contains 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
using System; using System.Linq; namespace EjemploDevDo { public class HourManagement { //Supongo que esta lista viene de una BD o de algún servicio private static readonly DateTime[] listaFeriados2013 = new[] { new DateTime(2013,1,1), new DateTime(2013,1,6), new DateTime(2013,1,26), new DateTime(2013,2,27), new DateTime(2013,3,29), new DateTime(2013,5,1), new DateTime(2013,5,30), new DateTime(2013,8,16), new DateTime(2013,9,24), new DateTime(2013,11,6), new DateTime(2013,12,25), }; public static DateTime CalcularFechaRespuesta(DateTime fechaInicio, int cantidadHoras) { var horaInicio = 8; var horaTermino = 17; var fechaRespuesta = fechaInicio; //Se aplica la operacion de |
This file contains 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
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
//Taken from stackoverflow | |
//http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values |