Skip to content

Instantly share code, notes, and snippets.

View alexpana's full-sized avatar

Alexandru Pană alexpana

  • Transylvania, RO
View GitHub Profile
const std = @import("std");
// const input = @embedFile("18.test.input");
const Operator = enum {
l_paren,
r_paren,
add,
sub,
mul,
@alexpana
alexpana / gist:e924e5e2b61fd28f0d24a1120d0a38ef
Created July 10, 2018 16:14
estimate read time of article in JS
WPM = 200; m = Array.from(document.getElementsByTagName("p")).reduce((acc, t) => acc + t.innerHTML, "").split(" ").length / WPM; h = Math.floor(m / 60); m = Math.floor(m % 60); msg = h > 0 ? h+"h "+m+"m" : m+"m";alert("Estimated read time: " + msg)
float FParticleRibbonEmitterInstance::Spawn(float DeltaTime)
{
bool bProcessSpawnRate = Spawn_Source(DeltaTime);
if (bProcessSpawnRate == false)
{
return SpawnFraction;
}
UParticleLODLevel* LODLevel = SpriteTemplate->LODLevels[0];
check(LODLevel);
import bpy
import os
from time import time
from bpy.props import BoolProperty, IntProperty, PointerProperty
bl_info = {
"name": "Image Auto Reload",
"description": "",
"author": "[email protected]",
"version": (0, 0, 1),
using UnityEngine;
namespace Camera
{
public class OrbitCameraController : MonoBehaviour
{
private const float MIN_DISTANCE = 0.5f;
private const float MAX_DISTANCE = 50f;
@alexpana
alexpana / inspiration.md
Last active May 25, 2018 06:21
For the forgetful

PostRock

  • Alcest
  • Circadian Eyes
  • Explosions in the Sky
  • Eluvium
  • Tides from Nebula
  • Break my fucking sky
  • Her name is Calla
  • Nyctalgia
  • God is an Astronaut
@alexpana
alexpana / hacks.md
Last active September 17, 2024 06:47
C++ is a hack

Various 'features' of C++ that show the hacky / inconsistent way in which the language was constructed. This is a work in progress, and currently contains some of the reasons I can remember why I've given up on C++. If you want to contribute, leave your favourite "hack" in the comments.

  1. (in)Visibility: C++ allows changing the access modifier of a virtual function in the derived class. Not only does C++ have no notion of interfaces, it actually allows subclasses to hide methods declared public in the superclass.

  2. Operator over-overloading: One of the increment operators takes a dummy int parameter in order to allow overloading. Can you tell which without googling? (hint: its postfix).

  3. Exception unspecifiers: C++ has two types of exception specifiers: throw() and nothrow. The first is deprecated (because 'we screwed up, sorry, let's forget about this terrible mess'). The second one guarantees it's contract by terminating the application when violated. That's because functions declared

class Point {
private final int x, y;
private final String name; // Cached at construction time
Point(int x, int y) {
this.x = x;
this.y = y;
name = makeName();
#include <memory>
#include <vector>
using namespace std;
class Test {
public:
// vector of unique pointers to int
vector<unique_ptr<int>> intVector;
// moves a unique pointer into the vector
{
"caret_style": "phase",
"fade_fold_buttons": false,
"font_face": "Consolas",
"font_size": 9,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],