Skip to content

Instantly share code, notes, and snippets.

@mariapacana
mariapacana / inheritance.md
Last active December 20, 2015 04:49
Javascript and Inheritance

Objects

  • Objects in Javascript are essentially hashes.
  • There are special types of objects such as strings, integers, and functions, but a 'plain Javascript object' is just a hash consisting of key-value pairs.
  • Keys must be strings. Values can be any object, including functions.

Prototypes

  • Every object has a 'prototype' that it inherits from.
  • Prototypes are simply objects containing various properties.
  • When you call a property of an object, Javascript first looks inside the object to retrieve that property. If it doesn't find it, it looks inside the object's prototype.
  • You can only set an object's prototype once; it can never be overwritten.
@mariapacana
mariapacana / pair.pl
Created August 23, 2013 03:41
Prolog code for generating pairs.
use_module(library(clpfd)).
:- use_module(library(lists)).
ingroup(1, 1).
ingroup(2, 1).
ingroup(3, 1).
ingroup(5, 1).
ingroup(3, 2).
ingroup(4, 2).
ingroup(5, 2).
@mariapacana
mariapacana / Sublime.md
Last active December 24, 2015 13:59
Sublime shortcuts

Linux

  • Control + Shift + P + rein -- reindent lines
  • Control + D -- select word
  • Control + U -- unselect word
  • Control + O -- open file
  • Control + W -- close tab
  • Control + KK -- delete to the end of line
  • Control + X -- cut entire line (or you can use this to delete)
  • Shift + Alt + (any number) -- split the window into that many panes (1 works, too)
  • Control + Shift + [Group #] -- move file to group