Skip to content

Instantly share code, notes, and snippets.

View Zorgatone's full-sized avatar

Tommaso Ricci Zorgatone

  • BrainQuark di Tommaso Ricci
  • Turin, Italy
  • 18:50 (UTC +02:00)
  • LinkedIn in/zorgatone
View GitHub Profile
@Zorgatone
Zorgatone / bulls_and_cows.cpp
Created February 23, 2017 16:24
Bulls and Cows game in C++
#include <iostream>
#include <vector>
#include <stdexcept>
#include <ctime>
#include <cstdlib>
#include <cctype>
using namespace std;
constexpr short int number_of_digits{ 4 };
@Zorgatone
Zorgatone / Matrix.cpp
Last active February 23, 2017 14:37
Matrix in C++11/C++14 using unique_ptr and make_unique
#include "Matrix.hpp"
using namespace std;
using namespace zgt;
struct Matrix::_impl {
unique_ptr<unique_ptr<MatrixRow>[]> _m;
_impl(size_t rows, size_t cols): _m(make_unique<unique_ptr<MatrixRow>[]>(rows)) {
for (size_t i{ 0 }; i < cols; i++) {
@Zorgatone
Zorgatone / kissanime-series-helper.user.js
Last active January 11, 2017 18:44
KissAnime Series Helper
// ==UserScript==
// @name KissAnime Series Helper
// @namespace http://zorgatone.tk/
// @version 0.2
// @description Hides the ads on KissAnime
// @author Zorgatone <[email protected]>
// @include /^https?://kissanime\.(?:com|to|ru)(?:\/.*)?$/
// @update https://rawgit.com/Zorgatone/1fec4be76e649d9d0c6fbe52f73e465a/raw/42c710be90e99f1114e2a94f5369fe0dfc3a0f10/kissanime-ad-blocker.user.js
// ==/UserScript==
@Zorgatone
Zorgatone / kissanime-ad-blocker.user.js
Last active August 23, 2018 10:54
KissAnime Ad-Blocker Userscript
// ==UserScript==
// @name KissAnime Ad-Blocker
// @namespace http://zorgatone.tk/
// @version 0.7.1
// @description Hides the ads on KissAnime
// @author Zorgatone <[email protected]>
// @include /^https?://kissanime\.(?:com|to|ru)(?:\/.*)?$/
// @update https://cdn.rawgit.com/Zorgatone/1fec4be76e649d9d0c6fbe52f73e465a/raw/499b5612ee2f45b8cb7b0702f08cec7da88482d6/kissanime-ad-blocker.user.js
// ==/UserScript==
@Zorgatone
Zorgatone / game-oop.ts
Last active December 23, 2016 10:44
OOP game example
interface IWearable {
wear: () => void;
}
interface IPlayable {}
class GameObject {
toString() {
return JSON.stringify(this, null, " ");
}
function random20Chars() {
return btoa((Math.random()).toFixed(20).slice(2,22)).slice(1, 21);
}
@Zorgatone
Zorgatone / keybase.md
Created September 5, 2016 09:00
keybase.md

Keybase proof

I hereby claim:

  • I am Zorgatone on github.
  • I am zorgatone (https://keybase.io/zorgatone) on keybase.
  • I have a public key whose fingerprint is 5975 04B1 088A 7AC8 F501 11BC E085 FA53 ED8D 7C59

To claim this, I am signing this object:

@Zorgatone
Zorgatone / typeUtils.js
Last active May 6, 2016 10:24
Type Utils (for AngularJS 1.x) v1.0.0 - a collection of useful type filters
/*!
* Type Utils (for AngularJS 1.x) v1.0.0 - a collection of useful type filters
* transpile ES2015 (ES6) with BabelJS
* Copyright 2015 Zorgatone; Licensed MIT
*/
export function isTypeFilter() {
return (val, type) => type === typeof val;
}
@Zorgatone
Zorgatone / dom-data.es6.js
Last active April 11, 2016 10:11
DomData
class DomData {
constructor() {
this.map = new WeakMap();
}
set(el, key, value) {
if (!(el instanceof HTMLElement)) {
throw new Error("Argument must be an instance of HTMLElement");
}
@Zorgatone
Zorgatone / toplevel-inheritance.es6.js
Created April 6, 2016 12:58
Inheritable Top-level Classes
"use strict";
Object.defineProperty(window, "BaseObject", {
value: (() => {
let nil = Object.freeze(Object.create(null));
Object.defineProperty(window, "Nil", {
value: (() => {
function Nil() {}
Nil.prototype = nil;