Skip to content

Instantly share code, notes, and snippets.

Maze escape 🏃

Given a two-dimensional array (the maze) and an array of steps, implement a solution to verify whether or not the player escaped the labyrinth.

  • The solution should output "Escaped" if the player reaches the maze's exit.
  • The solution should output "Dead" if the player hits a wall or goes outside the maze border.
  • The solution should output "Lost forever" if the player does not reach the maze's exit after taking all their steps.

The two-dimensional data structure that represents the maze looks like this:

openapi: 3.0.2
info:
version: 0.0.1
title: Rideshare API
description: |
The Rideshare API provides access to the rideshare service runned by [door2door](https://www.door2door.io/).
# Environments
This API can be consumed in two different environments, staging and production.
hello
world
from
berlin
@nicolasiensen
nicolasiensen / test-material-ui-event-simulation.js
Created December 20, 2016 11:38
Simulating events with Jest and Material UI
// Simulating clicks
const dashboardMount = mount(
<Dashboard />, {
context: { muiTheme },
childContextTypes: { muiTheme: React.PropTypes.object }
}
)
const menuButton = ReactDOM.findDOMNode(dashboardMount.find(AppBar).find(IconButton).find('button').node)
TestUtils.Simulate.touchTap(menuButton)
// This helper is required to test any component that renders material-ui components.
// If you are getting a message saying:
// 'undefined is not an object (evaluating this.context.muiTheme.prepareStyles)'
// you should use this helper.
// The usage is simple, you pass a component class to extendComponentWithMUITheme
// and it will return a new component class capable of rendering material-ui
// components
// const MyExtendedComponent = extendComponentWithMUITheme(MyComponent)
<html>
<head>
<title>ao vivo </title>
<!--JS JW6-->
<script type="text/javascript" src="http://a123.g.akamai.net/f/123/214238/1d/214258g.download.akamai.com/214238/_player/jwplayer6/6_9/jwplayer.js" ></script>
<script type="text/javascript">jwplayer.key = "ZfKOArQz+u1vxoCkwM9cihPjTUoVodJwgUCFZRpZLis=";</script>
</head>
<body>
<div id="dPlayer">
<div class="dTitulo_video"></div>
# require "~/Desktop/wordpress_parser.rb"
# parser = WordpressParser.new("/Users/nicolasiensen/Desktop/quintal.wordpress.2015-03-03.xml")
# posts = parser.posts
# posts.each_with_index {|post, i| puts i; parser.create_post post }
require 'nokogiri'
class WordpressParser
def initialize file_path = "quintal.wordpress.2015-03-03.xml"
@xml = Nokogiri::XML(File.open(file_path))
class OrganizationCreator
# TODO: add avatar, email_signature_html, bio and facebook_page_uid
def self.create_all
create_meu_recife
create_minha_blumenau
create_minha_campinas
create_minha_curitiba
create_minha_garopaba
create_minha_ouro_preto
@nicolasiensen
nicolasiensen / engaged_users.sql
Last active August 29, 2015 14:17
Most engaged users
SELECT first_name, last_name, email, count(*) AS activities_count
FROM users
JOIN activities
ON activities.user_id = users.id
GROUP BY users.id, users.first_name, users.last_name, users.email
HAVING count(*) > 4
LIMIT 750
Failure/Error: GithubProfile.for_username('mdeiters')
NoMethodError:
undefined method `keys' for nil:NilClass
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security/sanitizer.rb:19:in `debug_protected_attribute_removal'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:25:in `block in process_attributes'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:193:in `with_mass_assignment'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:22:in `process_attributes'