Skip to content

Instantly share code, notes, and snippets.

@avionbg
avionbg / Menu.html
Last active May 13, 2018 — forked from NamelessCoder/Menu.html
Rendering manual menus with VHS
View Menu.html
<div xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<!-- By setting the "as" argument, we create a new variable accessible inside tag content -->
<v:page.menu as="myMenuVariable">
<ol class="mySpecialMenu">
<f:for each="{myMenuVariable}" as="menuPage">
<li>
<!-- A few key properties are added on {menuPage} for user friendliness -->
<!-- These are: "linktext", "link", "active", "current", "hasSubPages" -->
<f:if condition="{menuPage.current}">
@avionbg
avionbg / mine_exploder_performance_test.py
Last active Feb 5, 2018
Test performance between recursion and ahead calculation with looping trough collections
View mine_exploder_performance_test.py
import numpy as np
import timeit
from collections import deque
NUMBER_OF_MINES = 10 ** 5
# Keep this low to prevent RuntimeError: maximum recursion depth exceeded
# (we can increase recursion depth, but it's ok also to avoid it just for the test)
MAX_BLAST_RADIUS = 200
MAX_COORDINATE_XY = 700000
@avionbg
avionbg / mine_exploder.py
Last active Feb 2, 2018
Python script to calculate chain reactions
View mine_exploder.py
import os.path
def within_blast_radius(x1, y1, blast_radius, x2, y2):
# Note that this counts points on the edge of the radius which is incorrect
# Proper way would be to exclude them as they are not in the radius (replace <= with <)
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) <= (blast_radius ** 2)
def explode_mine(mines, mine, exploded):
"""Recursive explosion calculation
@avionbg
avionbg / fileFromTemplateCommand.js
Created Aug 24, 2017
Bugfix for vscode-file-templates-ext - making multiple variables work
View fileFromTemplateCommand.js
"use strict";
var vscode = require("vscode");
var fs = require("fs");
var path = require("path");
var helpers = require("../helpers");
var moment = require("moment");
/**
* Main command to create a file from a template.
* This command can be invoked by the Command Palette or in a folder context menu on the explorer view.
* @export
View gist:72339ab9da75e9a95be9
#
# Automatically generated make config: don't edit
# Linux/arm 3.0.36 Kernel Configuration
#
CONFIG_ARM=y
You can’t perform that action at this time.