This file contains 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 Promise = require('promise'); | |
function* counter(){ | |
let i=0; | |
while(1){ | |
yield i++; | |
} | |
} | |
function wait(time){ |
This file contains 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 extend(...args) { | |
let obj = this||{}; | |
const l = args.length; | |
for (let i=0; i < l; i++) { | |
for (let k in args[i]) { | |
obj[k] = args[i][k]; | |
} | |
} | |
return obj; | |
} |
This file contains 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> | |
using namespace std; | |
template<class Getter> | |
struct VectorF { | |
const size_t N; | |
Getter Get; | |
template<class T> |
This file contains 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 <type_traits> | |
#include <iostream> | |
using namespace std; | |
auto Valid = [](auto...x) -> integral_constant<bool,1> {}; | |
template<class F,class...X> | |
constexpr auto is_callable(F f,X...x) | |
-> decltype( f(x...), true_type{} ) { | |
return{}; |
This file contains 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> | |
#include <array> | |
#include <tuple> | |
#include <type_traits> | |
#include <algorithm> | |
using namespace std; | |
auto Valid = [](auto...x) -> integral_constant<bool,1> {}; |
This file contains 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 inviteAll(i, clickTime, loadTime) { | |
i = (i !== undefined) ? i : 100; // how many people you like to add ? | |
clickTime = clickTime||350; // how quick can a human click ? | |
loadTime = loadTime||1000; // wait till next page is loaded | |
if (i<=0) return; | |
var invite = document. | |
querySelector('a[href^="/people/invite"]:not(.invite-sent)'); | |
// check if there a people to invite | |
if (invite) { | |
invite.click(); |
This file contains 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
// Jyt is a REPL for C++ | |
// You can write code interactively | |
// Highlight some code and press alt-enter to execute it | |
// For example: | |
auto x = "hello world"; | |
// Now you can query the value in the terminal on the right | |
// e.g. "x" |
This file contains 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 | |
#include<math.h> | |
#include<vector> | |
// This slow machine will barely be able to compute Fib1(30) | |
// O(n!) | |
constexpr auto FibR(size_t n) { |
This file contains 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 | |
//press play and call a function from the terminal on the right hand side | |
#include<math.h> | |
#include<vector> | |
#include<functional> | |
#include<tuple> | |
#include<algorithm> |
This file contains 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
//SFINAE - Substitution-Failure-Is-Not-An-Error | |
template<bool condition, class T> | |
struct enable_if { | |
using type = T; | |
}; | |
template<class T> | |
struct enable_if<false,T> |
OlderNewer