Skip to content

Instantly share code, notes, and snippets.

View annibal's full-sized avatar

Arthur Annibal annibal

View GitHub Profile
@annibal
annibal / HUD.py
Created June 25, 2013 14:43
Charger Tanker code, backup from when enemyes spawn in patterns. Orientation sucks in this =D
import pygame,math;
class HUD:
def setChargeBars(self,leftBar,rightBar):
self.leftChargeAmount = leftBar;
self.rightChargeAmount = rightBar;
self.maxCharge = 100;
def setHealth(self,health,shield,ammo):
self.health = health;
self.shield = shield;
@annibal
annibal / Tank_1.vb
Created June 25, 2013 14:51
Tank source code. might not work.
Public Class Form1
WithEvents t As New Timer With {.Interval = 30}
Dim p As New Panel
Dim g As Graphics
Dim kp(50) As Boolean
Class obj
Function sp(ByVal i As Object, ByVal x As Object, ByVal y As Object)
Me.pt(i).X = CSng(x)
Me.pt(i).Y = CSng(y)
End Function
@annibal
annibal / Tank_2.vb
Created June 25, 2013 14:51
Tank source code 2. it's bigger so this might not work less than Tank 1
Public Class Form1
WithEvents t As New Timer With {.Interval = 30}
Dim p As New Panel With {.Width = 500}
Dim g As Graphics
Dim kp(20) As Boolean
Dim canshoot As Integer = 0, canshoot2 As Integer = 0
Dim blow1, blow2, blow1x, blow1y, blow2x, blow2y As Integer
Dim AI As Boolean = False
Public power1, power2, speed1, speed2, delay1, delay2 As Integer
Dim iz As Integer = 0, jz As Integer = 0
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@annibal
annibal / hash-formatter.js
Last active October 18, 2024 14:31
JS Helpers for Random
/**
* clampAndSeparateStringInBlocks
* Separates a string in blocks by appending an separator character, and clamps the string to a desired length.
*
* @param {string} str input text
* @param {string} cfg.sep Separator, default "-"
* @param {number} cfg.len Desired length. Will slice if smaller than `str`, or prepend with `pad` if larger than `str` length.
* @param {number} cfg.siz Size (in characters) of each block. default 4
* @param {string} cfg.pad Padding character, to prepend when `str.length < len`. Default "0".
* @returns string.
@annibal
annibal / tableGenerator.js
Created April 16, 2019 18:39
Js Customizable Random Table generator
(function() {
function zeroFill(str, len, char) {
if ((str+"").length < len) {
return Array(len-(str+"").length).fill(char)+(str+"")
}
return (str+"")
}
function withVerifierDigits(numbers) {
numbers = numbers+""
@annibal
annibal / starting_vega_chart.json
Created May 7, 2019 14:11
Starting Vega Chart Spec
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 300,
"height": 300,
"padding": {
"top": 20,
"left": 80,
"bottom": 40,
"right": 20
},
@annibal
annibal / input.js
Created August 14, 2019 23:04
Javascript input mapper
const getKey = inputName => (inputs[namedIndexesMap[inputName]] || {value:null}).value
//TODO gamepad
class InputMap {
constructor(inputName, type='', assignedKeyboardKeys=[], assignedGamepadButtons=[], assignedGamepadAxis=[]) {
const strArrayToKeyObj = arr => arr.reduce( (all,curr) => ({...all, [curr]: true}),{})
if (inputName == null) {
throw TypeError("Input Name cannot be null or undefined ")
}
#!/bin/ksh
#
# @(69)$Id$
#
# Helpful functions for your terminal
function git_branches()
{
if [[ -z "$1" ]]; then
git_branches .
@annibal
annibal / jsAirflow.js
Created August 11, 2023 13:10
JS Airflow
// Main "Lib" function
/**
* Executes a flow of callbacks passing inputs and storing outputs
* Example: jsAirflow(
* [
* { fn: 'sum', in: ['v1', 'v2'], out: ['result'] },
* { fn: 'power', in: ['result', 'power'], out: ['result'] },