Skip to content

Instantly share code, notes, and snippets.

View jansanchez's full-sized avatar

Jan Sanchez jansanchez

View GitHub Profile
@jansanchez
jansanchez / gist:6145636
Last active December 20, 2015 14:19
Ruby Warrior - Level 3
# ruby warrior level 3
#
class Player
def play_turn(warrior)
if @needCure == nil
if warrior.health < 18
warrior.walk! :backward
@needCure = true
else
if warrior.feel.empty?
@jansanchez
jansanchez / gist:6161868
Last active December 20, 2015 16:29
Ruby Warrior - Level 4
# Advertencia: este código está horrible, los métodos no me funcionan, pero sirve para pasar
# ruby warrior level 4
#
class Player
def play_turn(warrior)
@health = warrior.health
if @needCure == nil
if @health < 18
if @health < 15
@jansanchez
jansanchez / gist:6181792
Last active December 20, 2015 19:18
Ruby Warrior - Level 5
# ruby warrior level 5
#
class Player
def play_turn(warrior)
@health = warrior.health
if @need_health == nil
if warrior.feel.empty?
@jansanchez
jansanchez / gist:6182139
Created August 8, 2013 06:50
Ruby Warrior - Level 6
# ruby warrior level 6
#
class Player
def play_turn(warrior)
@health = warrior.health
if @rescued == nil
if @ret == nil
@ret = true
@jansanchez
jansanchez / gist:6182230
Created August 8, 2013 07:05
Ruby Warrior - Level 7
# ruby warrior level 7
#
class Player
def play_turn(warrior)
@health = warrior.health
if @need_health == nil
if warrior.feel.wall?
warrior.pivot! :backward
@jansanchez
jansanchez / gist:6182598
Created August 8, 2013 08:08
Ruby Warrior - Level 8
# ruby warrior level 8
#
class Player
def play_turn(warrior)
@health = warrior.health
if warrior.feel.captive?
warrior.rescue!
@jansanchez
jansanchez / gist:6189664
Created August 8, 2013 23:07
How do you add NERDTree to your vimrc
Okay, the previous version was a bit terse, but the answer you're looking for is to add the line below into your ~/.vimrc file. It tells vim that you want to setup a command to run when vim starts, but since it depends on various plugins to be loaded, you don't want to run it until all initialization is finished. The line below does this.
autocmd VimEnter * NERDTree
If, however, you're annoyed by the fact that the cursor always starts in the NERDTree window, you can add a second autocommand that will move the cursor into the main window, like so:
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
@jansanchez
jansanchez / gist:6189791
Last active December 20, 2015 20:19
.vimrc.local
colorscheme railscasts
:au FocusLost * :set number
:au FocusGained * :set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
@jansanchez
jansanchez / gist:6191384
Created August 9, 2013 05:31
Auto Login en Linux CrunchBang Waldorf
#Autologin en #Waldorf #!
sudo apt-get install slimconf
gksudo slimconf
@jansanchez
jansanchez / gist:6191406
Last active December 20, 2015 20:38
Initial steps for linux crunchbang waldorf
# Install Packages for Crunchbang
cb-welcome
# Install Vim
sudo apt-get install vim
# The better vim plugins and resources for Vim, Gvim and MacVim