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
| function! BuildOutput(output) | |
| let winnum = bufwinnr('BUILD') | |
| if winnum != -1 | |
| if winnr() != winnum | |
| exec winnum . "wincmd w" | |
| endif | |
| else | |
| belowright split BUILD | |
| setlocal buftype=nofile | |
| resize 15 |
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> | |
| <canvas id="screen" style="border:1px solid #000" width=640 height=480 /> | |
| </body> | |
| <script type="text/javascript"> | |
| // Demonstration of bezier curves by recursive definition | |
| // For the purposes of this, a point is an object with x and y members | |
| var c = document.getElementById("screen"); |
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
| namespace ConstructorFun | |
| { | |
| class ConstructorLoop | |
| { | |
| public ConstructorLoop(int a, int b) : this(a, b, 20) | |
| { } | |
| public ConstructorLoop(int a, int b, int c) : this(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
| import random | |
| add = lambda a,b: a+b | |
| sub = lambda a,b: a-b | |
| mul = lambda a,b: a*b | |
| div = lambda a,b: a/b if a % b == 0 else 0/0 | |
| operations = [ (add, '+'), | |
| (sub, '-'), | |
| (mul, '*'), |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace Countdown | |
| { | |
| internal interface IExpression { }; | |
| class Op : IExpression | |
| { |
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 counter = function(start) { | |
| var c = start || 0; | |
| return function(amount) { | |
| c = c + (amount || 1); | |
| return c; | |
| } | |
| }(42); | |
| console.log(counter()); // 43 | |
| console.log(counter(5)); // 48 |
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 counter = function() { | |
| var c = 0; | |
| return function() { | |
| c = c + 1; | |
| return c; | |
| } | |
| }(); | |
| console.log(counter()); // 1 | |
| console.log(counter()); // 2 |
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 Base: | |
| def mul(self, a, b): | |
| return a * b | |
| def add(self,a,b): | |
| return a + b | |
| class Derived(Base): | |
| def sub(self,a,b): | |
| return 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
| -- Given this in Lisp: | |
| -- (defn eddington [a] (count (filter true? (keep-indexed < (reverse (sort a)))))) | |
| -- do it in Haskell (thanks to @zimpenfish for the original) | |
| import Data.List | |
| -- keep-indexed f l applies f over l and keeps the result of anything that is | |
| -- not nil. f takes two arguments, index of list item and list item | |
| -- We can do this in Haskell by zipping the original list with the indices |