Skip to content

Instantly share code, notes, and snippets.

View gmrdad82's full-sized avatar
🎮
Gaming

Catalin Ilinca gmrdad82

🎮
Gaming
  • Castellon de la Plana, Spain
  • 03:59 (UTC +02:00)
  • YouTube @GmrDad82
View GitHub Profile

Per-directory Bash history (w/o aliasing cd)

I use Bash’s PROMPT_COMMAND variable:

The value of the variable PROMPT_COMMAND is examined just before Bash prints each primary prompt. If PROMPT_COMMAND is set and has a non-null value, then the value is executed just as if it had been typed on the command line.

The source code should be pretty straight forward, but if not, please ask in the comments. Put this in your .bashrc or similar:

# per-directory Bash history
@gmrdad82
gmrdad82 / index.html
Created December 18, 2013 14:30 — forked from neave/index.html
<!DOCTYPE html>
<html>
<head>
<style> body { margin: 0; } </style>
</head>
<body>
<canvas id="wobble"></canvas>
<script src="http://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.min.js"></script>
<script src="wobble.js"></script>
</body>
# 1. RectangularRoom
class RectangularRoom(object):
def __init__(self, width, height):
self.width, self.height = width, height
self.tiles = dict(((x, y), 0) for x in range(width) for y in range(height))
def cleanTileAtPosition(self, pos):
self.tiles[(int(pos.x), int(pos.y))] += 1
def isTileCleaned(self, m, n):
from string import ascii_lowercase as lower, ascii_uppercase as upper, ascii_letters as both
# 1. Build a coder
def buildCoder(shift):
return dict(zip(both, (lower[shift:] + lower[:shift] + upper[shift:] + upper[:shift])))
# 2. Apply the coder
def applyCoder(text, coder):
return "".join([coder.get(letter, letter) for letter in text])
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems: