Skip to content

Instantly share code, notes, and snippets.

@dayorbyte
dayorbyte / 3114.osx.keymap
Last active June 20, 2016 11:32
sublime 3114 osx keymap
/*
On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings,
and don't need to be repeated here. Anything listed here will take precedence, however.
*/
[
{ "keys": ["super+shift+n"], "command": "new_window" },
{ "keys": ["super+shift+w"], "command": "close_window" },
{ "keys": ["super+o"], "command": "prompt_open" },
{ "keys": ["super+shift+t"], "command": "reopen_last_file" },
{ "keys": ["super+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
@dayorbyte
dayorbyte / 3114.linux.keymap
Created June 20, 2016 11:29
sublime 3114 linux keymap
[
{ "keys": ["ctrl+q"], "command": "exit" },
{ "keys": ["ctrl+shift+n"], "command": "new_window" },
{ "keys": ["ctrl+shift+w"], "command": "close_window" },
{ "keys": ["ctrl+o"], "command": "prompt_open_file" },
{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file" },
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
@dayorbyte
dayorbyte / 3114.windows.keymap
Created June 20, 2016 11:29
sublime 3114 windows keymap
[
{ "keys": ["ctrl+shift+n"], "command": "new_window" },
{ "keys": ["ctrl+shift+w"], "command": "close_window" },
{ "keys": ["ctrl+o"], "command": "prompt_open_file" },
{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file" },
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
{ "keys": ["ctrl+shift+s"], "command": "prompt_save_as" },
{ "keys": ["ctrl+f4"], "command": "close_file" },
@dayorbyte
dayorbyte / gist:5724082
Created June 6, 2013 19:11
Simple tornado example
import tornado.ioloop
from tornado.web import RequestHandler
class HomeHandler(RequestHandler):
def get(self):
self.write('Hello, world')
def post(self):
self.write('<h1>You posted to get here!</h1>')
self.write('Name: ' + self.get_argument('name'))
import random
def main():
a = AVLTree()
for i in range(0, 100):
# print '-----------------------------------'
a.insert(random.randrange(0, 100000))
a.pr()
assert len(list(a.traverse())) == 100, len(list(a.traverse()))
for v in a.traverse():
print v,
import scala.util.Random
import scala.math.max
class AVLTree[T <% Ordered[T]] (root: Option[AVLNode[T]] = None) {
def insert(t: T): AVLTree[T] = {
root match {
case None => new AVLTree(Some(AVLNode(value=t)))
case Some(x) => new AVLTree(Some(x.insert(value=t)))
}