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
| extern int __fastcall InitMenuHandler_orig(struct tag_message & msg); | |
| extern font* smallFont; | |
| extern font* bigFont; | |
| extern heroWindow* gpInitWin; | |
| extern void __fastcall FillBitmapArea(class bitmap *, int, int, int, int, int); | |
| int __fastcall InitMenuHandler(struct tag_message & msg) { | |
| if (msg.eventCode == INPUT_MOUSEMOVE_EVENT_CODE) { |
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
| {-# LANGUAGE GADTs #-} | |
| module HowAreEqualityConstraintsCompiled where | |
| data TypeEq a b where | |
| Refl :: (a ~ b) => TypeEq a b | |
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
| {-# LANGUAGE GADTs, TypeOperators, DeriveFunctor, DataKinds, KindSignatures, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, OverlappingInstances, TypeFamilies, UndecidableInstances, FunctionalDependencies, ScopedTypeVariables #-} | |
| module ConstMemDlc where | |
| import qualified Data.Map as Map | |
| import Data.Proxy | |
| import GHC.TypeLits | |
| import Data.Type.Equality |
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
| # From "Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015" | |
| # Bad code | |
| import jnettools.toolselements.NetworkElement, \ | |
| jnettools.tools.Routing, \ | |
| jnettools.tools.RouteInspector | |
| ne=jnettools.tools.elements.NetworkElement( '171.0.2.45' ) | |
| try: |
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
| adt Prog { | |
| Var1 {} | |
| Var2 {} | |
| Const {int val; } | |
| Add { Prog left; Prog right; } | |
| Mul { Prog left; Prog right; } | |
| } | |
| int interpret(Prog prog, int x, int y) { | |
| switch(prog) { |
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
| data Exp = Lit String | |
| pprint :: Exp -> String | |
| pprint = (\(Lit s) -> a ++ "'" ++ s ++ "'") where a free | |
| pprint = (\(Lit s) -> a ++ "\"" ++ s ++ "\"") where a free | |
| parse :: String -> (Exp, Exp -> String) | |
| parse s | s =:= f x = (x, f) | |
| where | |
| f = 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
| from test import multibytecodec_support | |
| import unittest | |
| # Inlining t5 makes the test pass | |
| t5 = multibytecodec_support.TestBase_Mapping | |
| class TestGB18030Map(t5, unittest.TestCase): | |
| encoding = 'gb18030' | |
| mapfileurl = 'http://www.pythontest.net/unicode/gb-18030-2000.xml' | |
| t7 = __name__ == "__main__" |
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
| pragma options "--bnd-inline-amnt 5 --bnd-inbits 2 --bnd-cbits 3 "; | |
| int BASE = 4; | |
| int[2*N] mult(int N, int[N] x, int[N] y){ | |
| int[2*N] out = 0; | |
| for(int i=0; i<N; ++i){ | |
| for(int j=0; j<N; ++j){ |
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
| /* Original samples: | |
| Sample 7: | |
| Query rangeQuery(String field, Object lowerTerm, Object upperTerm, | |
| boolean includeLower, boolean includeUpper) { | |
| double l = Double.NEGATIVE_INFINITY; | |
| double u = Double.POSITIVE_INFINITY; | |
| if (lowerTerm != null) { | |
| l = parse(lowerTerm); |