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> | |
| bool is_same_type(T a,T b) { | |
| return true; | |
| } | |
| template<typename T, typename S> | |
| bool is_same_type(T a,S b) { | |
| return false; |
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
| slowcat - the webapp |
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
| # Julia 0.6 syntax: | |
| # motivate: wanted a 'trait' like way to get from 'Int16' to 'UInt16' | |
| # there must be a standard way to do that | |
| parse_signed_Int16( str) = signed( parse( UInt16, str ) ) | |
| # define: (must have some standard def?) |
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
| HAI 1.2 | |
| HOW DUZ I FiBl00p YR n | |
| I HAS A i ITZ 0 | |
| I HAS A a ITZ 1 | |
| I HAS A b ITZ 1 | |
| IM IN YR l00p UPPIN YR i TIL BOTH SAEM i AN 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
| fib :: Int -> Int | |
| fib 0 = 1 | |
| fib 1 = 1 | |
| fib n = fib(n-1) + fib(n-2) | |
| main = print (fib 6) | |
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
| // fibonacci seq - naïve, and tail recursion | |
| function fib_r(n) { | |
| return n <= 1 ? 1 : fib_r(n - 1) + fib_r(n - 2) | |
| } | |
| console.log(fib_r(5)); | |
| function fib_tail_rec(n) { | |
| f = function(f_1, f_2, 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
| import Foundation | |
| import AVFoundation | |
| /** | |
| Set as a delegate for a _AVAudioPlayer_ instance, | |
| to measure when an audio-clip was in-fact played. | |
| Specifically - when recording a player device, |
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
| # niqqud utils: | |
| get_alpha(str) = filter(isalpha,str) | |
| niqqudless(str) = map(graphemes(str)) do g | |
| isempty(get_alpha(g))? g : get_alpha(g) | |
| end |> join | |
| # test: | |
| str = "מָרְדֳּכָי" | |
| expect = "מרדכי" |
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
| // At last: in C++11 and on - we can do multiple 'return'/assigments in C++ | |
| // Compile: | |
| // $ c++ -std=c++11 -stdlib=libc++ fib.cc && ./a.out | |
| #include <tuple> | |
| using namespace std; | |
| // "Python style" swap: | |
| int fib(int 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
| "use strict"; | |
| // geez to latin script :: | |
| // alt: | |
| // s=document.getSelection();for(i=0;i<frames.length;i++){if(s)break;s=frames[i].document.getSelection();}if(!s)void(s=prompt('Enter search terms for Wikipedia',''));wikiw=open('http://en.wikipedia.org/'+(s?'w/wiki.phtml?search='+s:''));wikiw.focus(); |