Skip to content

Instantly share code, notes, and snippets.

Avatar

Vittorio Romeo SuperV1234

View GitHub Profile
@cslarsen
cslarsen / euler_phi.cpp
Created Jan 18, 2012
Euler's totient function phi --- a fast implementation in C++
View euler_phi.cpp
/*
* Euler's totient function phi(n).
* http://en.wikipedia.org/wiki/Euler%27s_totient_function
*
* This is an *EXTREMELY* fast function and uses
* several tricks to recurse.
*
* It assumes you have a list of primes and a fast
* isprime() function. Typically, you use a bitset
* to implement the sieve of Eratosthenes and use
@alex-ac
alex-ac / Lua.cc
Last active Dec 11, 2018
Lua C++ wrapper. C++11 templates street magic.
View Lua.cc
#include <Lua.hh>
extern "C" {
#include <lualib.h>
#include <lauxlib.h>
};
using namespace util;
int Lua::call(lua_State *vm) {
@sim642
sim642 / delegate.hpp
Last active Jul 22, 2020
C++11 variadic template class for C# equivalent of delegates.
View delegate.hpp
#ifndef DELEGATE_HPP_INCLUDED
#define DELEGATE_HPP_INCLUDED
#include <functional>
#include <vector>
// general case
template<typename R, typename... Args>
class delegate
{
@SuperV1234
SuperV1234 / FastFunc.hpp
Last active Mar 2, 2020
Don Clugston's fast delegate C++11 implementation
View FastFunc.hpp
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>
@lichray
lichray / static_if.cc
Created Sep 13, 2014
Implement static_if using C11 generic selection
View static_if.cc
#include <type_traits>
#include <tuple>
#include <iostream>
// Link: https://github.com/aeyakovenko/notes
//count arguments
//COUNT_ARGS :: ... -> Int
#define COUNT_ARGS(...) COUNT_ARGS_(,##__VA_ARGS__,6,5,4,3,2,1,0)
#define COUNT_ARGS_(z,a,b,c,d,e,f,cnt,...) cnt
@imneme
imneme / randutils.hpp
Last active Jun 23, 2020
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
View randutils.hpp
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Melissa E. O'Neill
*
View answer.md

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@bmwalters
bmwalters / PKGBUILD
Last active Nov 20, 2018
Arch PKGBUILD for Vittorio Romeo's OpenHexagon / SSVOpenHexagon
View PKGBUILD
# Maintainer: Bradley Walters <oss@walters.app>
pkgname=openhexagon-git
pkgver=r1733.4791b23
pkgrel=1
pkgdesc='C++14 FOSS clone of "Super Hexagon"'
arch=('i686' 'x86_64' 'armv6h') # TODO: check these
url="https://vittorioromeo.info/projects.html"
license=('custom:AFL-3.0')
depends=('sfml' 'lua')
You can’t perform that action at this time.