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
| html,body,div,p{margin:0;padding:0;border:0;} | |
| .dp20,.dp25,.dp33,.dp50,.dp100{float:left;display:inline;*margin-left:-0.04em;} | |
| .dp20{width:20%;} | |
| .dp25{width:25%;} | |
| .dp33{width:33.33%;} | |
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 append(e, l = []): | |
| l.append(e) | |
| return l | |
| tmp0 = append("what") | |
| tmp1 = append("the") | |
| tmp2 = append("fuck") | |
| print tmp2 # → ['what', 'the', 'fuck'] |
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
| typedef union _zvalue_value { | |
| long lval; /* long value */ | |
| double dval; /* double value */ | |
| struct { | |
| char *val; | |
| int len; | |
| } str; | |
| HashTable *ht; /* hash table value */ | |
| zend_object_value obj; |
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
| -module(server). | |
| -export([start/0]). | |
| % 1 - Download and install Mochiweb, make sure it is in the ebin path (-pa). | |
| % 2 - Run with server:start() | |
| % 3 - Point you browser to http://127.0.0.1:12345/something | |
| % 4 - A primitive benchmark: "ab -c 1000 -n 10000 http://127.0.0.1:12345/test" | |
| start() -> | |
| Options = [ |
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 scala.actors.Actor | |
| import scala.actors.Actor._ | |
| case class Inc(amount: Int) | |
| case class Value | |
| class Counter extends Actor { | |
| var counter: Int = 0; | |
| def act() = { |
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
| module Main where | |
| import Control.Concurrent | |
| import Control.Exception | |
| import System.IO.Unsafe | |
| proc :: MVar Int -> IO () | |
| proc m = do | |
| v <- takeMVar m |
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
| -module(counter_with_locks). | |
| -compile(export_all). | |
| start_counter() -> | |
| Pid = spawn(?MODULE, counter_loop, [0]), | |
| register(counter, Pid). | |
| counter_loop(N) -> | |
| receive |
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
| -module(counter_with_retry). | |
| -compile(export_all). | |
| start_counter() -> | |
| Pid = spawn(?MODULE, counter_loop, [0]), | |
| register(counter, Pid). | |
| counter_loop(N) -> | |
| receive |
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
| module Main where | |
| import Control.Monad.Writer | |
| import System(getArgs, getProgName) | |
| data Column = LeftCol | MiddleCol | RightCol | |
| -- describe the move of one block from column src to column dst | |
| describeMove :: Int -> Column -> Column -> Writer String () | |
| describeMove object src dst = do |
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
| /** | |
| * g++ `llvm-config --cxxflags` -c -o test.o test.cpp | |
| * g++ -o test `llvm-config --ldflags --libs` test.o | |
| */ | |
| #include "llvm/Module.h" | |
| #include "llvm/Instructions.h" | |
| #include "llvm/ModuleProvider.h" | |
| #include "llvm/Analysis/Verifier.h" | |
| #include "llvm/ExecutionEngine/JIT.h" |
OlderNewer