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
| use std::str::CharRange; | |
| struct El<T> { | |
| ch : char, | |
| children : Trie<T> | |
| } | |
| pub struct Trie<T> { | |
| elements : Vec<El<T>>, | |
| data : Option<T> |
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
| struct S { | |
| S(int) {} | |
| S(const S&) = delete; | |
| }; | |
| int main() { | |
| auto a = S { 5 }; // no go | |
| S s {5}; // ok | |
| return 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
| echo off | |
| echo ; set +v # > NUL | |
| echo ; function GOTO { true; } # > NUL | |
| GOTO WIN | |
| # On Unix, we need to explicitly invoke CLR executables with mono | |
| /usr/bin/env mono $@ | |
| exit 0 | |
| :WIN |
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
| -- sort function, optimized for lists | |
| -- TODO - profiling | |
| sortBy compare = head . head . dropWhile (isn't unsafeCoerce . drop 1) . group . iterate bubble | |
| where | |
| bubble [] = [] | |
| bubble [x] = [x] | |
| bubble (x:y:ys) = | |
| if compare x y == GT | |
| then y:(bubble (x:ys)) | |
| else |
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 FlexibleInstances #-} | |
| module Main where | |
| import Control.Applicative ((<$>)) | |
| import Control.Monad.State.Lazy as S | |
| class Monad m => World m where | |
| writeLine :: String -> m () | |
| instance World IO where |
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 <stdio.h> | |
| enum Enumeration { | |
| ENUM = 0, | |
| }; | |
| struct S final { | |
| explicit S(unsigned short id) | |
| : S(ENUM, value) | |
| { } |
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
| template<class T,class...>class C{C<T*const,T,C>a;C<T,C>b;};C<int>c; |
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
| (defun revert-all-buffers () | |
| "Refreshes all open buffers from their respective files." | |
| (interactive) | |
| (dolist (buf (buffer-list)) | |
| (with-current-buffer buf | |
| (when (and (buffer-file-name) (not (buffer-modified-p))) | |
| (revert-buffer t t t) ))) | |
| (message "Refreshed open files.") ) |
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 | |
| class C { | |
| public function call_private_function($f) { | |
| return $f(); | |
| } | |
| private function run() { | |
| echo "run!\n"; | |
| } |
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 | |
| class B { | |
| public function __call($fn, $args) { | |
| $c = array($this, 'hello'); | |
| $c(); | |
| } | |
| private function hello() { | |
| echo "hello B\n"; |