Skip to content

Instantly share code, notes, and snippets.

View annibal's full-sized avatar

Arthur Annibal annibal

View GitHub Profile
@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.
# 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 / 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
@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 / 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;