Cleaner complex IF Statements

Cleaner complex IF Statements

So you have this long if statement that's relatively simple in design but ugly to the eyes and somewhat hard to read. if(x1>=img.left&&x1<=img.left+img.current.width&& y1>=img.top&&y1<=img.top+img.current.height&& x2>=img.left&&x2<=img.left+img.current.width&& y2>=img.top&&y2<=img.top+img.current.height){ img.scaling = Math.pow(x1-x2,2)+Math.pow(y1-y2,2); } //end if What can we do to make it…

Read More

Pigeon Hole Stepping

Pigeon Hole Stepping

For 7DRL this year I developed a new map generation algorithm called Pigeon Hole Stepping. Fill the map with walls This map generation algorithm relies on negative building techniques. This concept will make more sense as the later steps are explained. Dig Hallways Essentially, we can assume that hallways that are parallel to each other are at least the length of a single room and up to two rooms apart in distance. Because of this assumption, we can make a random walker that will move around with this restriction in mind until map is filled completely. Allocate Rooms Assuming the…

Read More

NPM Module: Slush Jugs

NPM Module: Slush Jugs

Last week I updated the npm module slush-jugs to include support for a more robust script compilation system using Webpack inside of Gulp. This will allow us to have a commons module that automatically pulls out any vendor-specific code that might be duplicated across the application and separate it into it's own file. This is also important if we don't want to constantly update cached versions of vendor assets on users computers when all they need to do is update the smaller footprint of the actual application code that was updated. Below are a list of all the changes in…

Read More

.zshrc

.zshrc

It all started one long rainy night after setting down my Archlinux laptop and picking up my macbook pro.. inevitably annoyed quickly by the ancient bash version. Switched to zshell. Downloaded oh-my-zsh for a prettiness template to start with.. customized my own theme, and have been hooked for a solid 3 months so far. # Variable declaration ZSH_THEME="powerlevel9k/powerlevel9k" HIST_STAMPS="dd.mm.yyyy" POWERLEVEL9K_PROMPT_ON_NEWLINE=true plugins=(git) # User configuration export ZSH=/Users/nateinman/.oh-my-zsh source $ZSH/oh-my-zsh.sh export LANG=en_US.UTF-8 export PATH=/usr/local/share/npm/lib/node_modules/grunt-cli/bin:$PATH…

Read More