Skip to content

Instantly share code, notes, and snippets.

View nikhedonia's full-sized avatar
💭
actively open-sourcing

Gaetano Checinski nikhedonia

💭
actively open-sourcing
View GitHub Profile
@nikhedonia
nikhedonia / async_generator.js
Created June 25, 2015 23:26
async_generator example
var Promise = require('promise');
function* counter(){
let i=0;
while(1){
yield i++;
}
}
function wait(time){
@nikhedonia
nikhedonia / ES7SQL.js
Last active August 29, 2015 14:27
ES7SQL
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;
}
@nikhedonia
nikhedonia / example.cpp
Last active October 24, 2015 19:16
Opaque Functional MatrixType
#include <iostream>
using namespace std;
template<class Getter>
struct VectorF {
const size_t N;
Getter Get;
template<class T>
#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{};
@nikhedonia
nikhedonia / contracts.cpp
Created November 10, 2015 21:14
buggy...
#include <iostream>
#include <array>
#include <tuple>
#include <type_traits>
#include <algorithm>
using namespace std;
auto Valid = [](auto...x) -> integral_constant<bool,1> {};
@nikhedonia
nikhedonia / linkedIn-invite-all.js
Last active August 15, 2016 00:47
invites everybody who shows up on your search page
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();
// 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"
// 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) {
@nikhedonia
nikhedonia / Fib.cpp
Last active August 31, 2016 18:53
Gist created by https://fiddle.jyt.io
// 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>
//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>