Gabriel Garcia Garciat

View count_digits.d
1 2 3 4 5 6 7 8 9 10
import std.stdio, std.typetuple, std.traits;
 
template maxexp(T, uint base, T acc = T.max, uint i = 0)
if (isIntegral!T && base > 1)
{
static if (acc == 0)
{
enum maxexp = i - 1;
}
else
View devirt.cpp
1 2 3 4 5 6 7 8 9 10
#include <utility>
#include <typeinfo>
 
struct Base {
virtual int f() = 0;
};
 
struct Derived1 : public Base {
virtual int f() final override {
return 42;
View tuple_explode.cpp
1 2 3 4 5 6 7 8 9 10
/*
 
La primera idea que se me vino a la mente para
http://channel9.msdn.com/Events/GoingNative/2013/The-Way-of-the-Exploding-Tuple
 
No recomendaria su uso, pero es otra forma de atacar al reto.
 
*/
#include <cstring>
#include <tuple>
View simplex.py
1 2 3 4 5 6 7 8 9 10
from fractions import Fraction
 
def fraccionalizar(mat):
for f in xrange(len(mat)):
for c in xrange(len(mat[0])):
mat[f][c] = Fraction(mat[f][c])
return mat
 
def mostrar(mat):
for f in mat:
View function_traits.cpp
1 2 3 4 5 6 7 8 9 10
#include <iostream>
#include <tuple>
#include <string>
#include <typeinfo>
#include <memory>
#include <cxxabi.h>
 
namespace extra {
template <typename... Types>
struct TypeInfoExtractor;
View ruby_n_times.d
1 2 3 4 5 6 7 8 9 10
import std.traits, std.stdio;
 
void times(F)(uint n, F func)
if (isSomeFunction!F)
{
immutable ar = arity!func;
 
foreach (uint i; 0 .. n) {
static if (ar == 0) {
func();
View closure_list.js
1 2 3 4 5 6 7 8 9 10
function list(v) {
function errchk(f, e) {
try {
return f();
} catch (err) {
if (err instanceof ReferenceError &&
err.message.match(/^[v]+\s/) !== null) {
return e ? e() : undefined;
}
View leonardo_numbers.cpp
1 2 3 4 5 6 7 8 9
#include <type_traits>
#include <array>
#include <climits>
#include <iostream>
#include <algorithm>
#include <tuple>
 
template<size_t... Vals>
struct Sequence { };
View screenshot.py
1 2 3 4 5 6 7 8 9
import tempfile, os, requests, json, webbrowser
import pyscreenshot as pyscr
from base64 import b64encode
 
# required modules: pyscreenshot, PIL, requests
 
__client_id__ = '...'
__client_secret__ = '...'
__cred_keys__ = ['access_token', 'refresh_token', 'token_type', 'expires_in']
View main.cpp
1 2 3 4 5 6 7 8 9 10
#include "siterator.hpp"
#include "repeater.hpp"
#include "to_bool_arr.hpp"
 
#include <iostream>
#include <array>
 
int main() {
using namespace siterator;
using namespace extra;
Something went wrong with that request. Please try again.