This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Main { | |
| abstract class Tree | |
| case class Sum(l: Tree, r: Tree) extends Tree | |
| case class Var(n: String) extends Tree | |
| case class Const(v: Int) extends Tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def f(n): | |
| def g(m): | |
| def h(s): | |
| return m + n + s | |
| return h | |
| return g | |
| a = f(1)(2) | |
| print a | |
| print a(3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class retraceable_property(property): | |
| """A decorator that traces how a property changes over time. | |
| In real life, you may find yourself in a situation in which you keep track | |
| of a variable that changes over time. It may be a path of a moving object | |
| or (something else; it's late at night and my brain is a bit cloudy so I | |
| can't give you another brilliant example. I'll fill this in later). As an | |
| over-simplified example, you may write code to keep adding two to a | |
| variable in every | |
| second as follows: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pyopencl as cl | |
| ROWS = 10 | |
| COLS = 10 | |
| def run(): | |
| a_np = np.random.rand(ROWS, COLS).astype(np.float32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var openPdf = function(filename) { | |
| window.open('http://file.shinhaninvest.com/filedoc/otc/' + filename); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import __builtin__; __builtin__.B = __import__('pdb').set_trace | |
| import __builtin__; __builtin__.pprint = __import__('pprint').pprint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import inspect | |
| #: Annual percentage rate of your savings account, certificate of deposit, etc. | |
| APR = 0.032 | |
| TAX_RATE = 0.154 | |
| class Terms: | |
| def __init__(self, deposit, rent, utilities, commute_time, commute_cost): | |
| frame = inspect.currentframe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/signal" | |
| "time" | |
| "github.com/davecheney/gpio" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import picamera | |
| def test_camera(): | |
| with picamera.PiCamera() as camera: | |
| camera.capture('image.jpg') | |
| if __name__ == '__main__': | |
| test_camera() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import sys | |
| import time | |
| DATE_COLUMN = 1 | |
| DESCRIPTION_COLUMN = 6 | |
| DEBIT_COLUMN = 4 | |
| CREDIT_COLUMN = 5 |