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
#include <iostream> | |
template <typename T> // template A | |
T ShowArray(T arr[], int n); | |
template <typename T> // template B | |
double ShowArray(T * arr[], int n); | |
struct debts | |
{ |
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
<?php | |
interface WorkerInterface | |
{ | |
public function work($job); | |
} | |
abstract class Worker implements WorkerInterface | |
{ | |
private $queue_info; |
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
<?php | |
interface Json | |
{ | |
public function getJson(); | |
} | |
abstract Class BaseData implements Json {} | |
class TwitterData extends BaseData |
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 unittest | |
class Test(unittest.TestCase): | |
def test_answer_a(self): | |
self.assertEqual(9 - 3, 6) | |
def test_answer_b(self): | |
self.assertEqual(9 - 3, 6) | |
def test_answer_c(self): |
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
#!/usr/bin/env python | |
temp = 24 | |
temp = temp * 1.8 + 32 | |
print "result: ", str(temp) |
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
#!/usr/bin/env python | |
x = 1.5 | |
y = 4 | |
x = x + y | |
print "x = ", str(x), ", y = ", str(y) # x = 5.5 , y = 4 |
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
#!/usr/bin/env python | |
x = 3 | |
x += x - x | |
print "x = ", str(x) # "x = 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
import token | |
import ast | |
def main(): | |
plus = token.Token(token.Token.PLUS, "+") | |
one = token.Token(token.Token.INT, "1") | |
two = token.Token(token.Token.INT, "2") | |
root = ast.AST(plus) | |
root.addChild(ast.AST(one)) | |
root.addChild(ast.AST(two)) |
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 token | |
class AST: | |
def __init__(self, *args): | |
self.children = [] | |
if 0 == len(args): | |
self.token = None | |
elif 1 == len(args): | |
if (isinstance(args[0], token.Token)): | |
self.token = args[0] |
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 Token: | |
INVALID_TOKEN_TYPE = 0 | |
PLUS = 1 | |
INT = 2 | |
def __init__(self, *args): | |
if 1 == len(args): | |
self.type = args[0] | |
elif 2 == len(args): | |
self.type = args[0] | |
self.text = args[1] |