Skip to content

Instantly share code, notes, and snippets.

View pablomayobre's full-sized avatar
📖
Learning new technologies

Pablo Ariel Mayobre pablomayobre

📖
Learning new technologies
  • NewCombin
  • Trelew, Chubut, Argentina
View GitHub Profile
@pablomayobre
pablomayobre / batch.lua
Last active December 22, 2018 01:11
Perform many removal, inserting operations on a table, fast!
local batch = {}
local holes_err = "bad argument #%s to function '%s' (this list doesn't support holes)"
local refill = function (t, ...)
local newn = select('#', ...)
local length = math.max(newn, (t.n or #t))
for i = 1, length do
t[i] = select(i, ...)
@pablomayobre
pablomayobre / main-src.lua
Created January 19, 2017 07:55
1K - Tic Tac Toe in LÖVE (multi player)
--Note that when I performed the minification
--I changed a lots of parts of the code
--In order to get into the 1024 characters
--Some of those reductions are not performed in this code
--This is only a guide to understand how the game works
Y = require 'bit' --Bitops
a,b,c = Y.bnot,Y.bor,Y.band --Operations
m = a(0) --Max integer
@pablomayobre
pablomayobre / main-pretty.lua
Last active October 18, 2018 16:27
1K - Tic Tac Toe in LÖVE (with AI)
local bit = require 'bit' --Bitops
local max_int = bit.bnot(0) --Max integer
--Players are represented as 9bit numbers
local players = {0,0}
--Winner (1 - player 1, 2 - player 2, 3 - tie, nil - still playing)
local winner = nil
local tile_size = 200 --Tile width and height
love.window.setMode(tile_size * 3, tile_size * 3)
@pablomayobre
pablomayobre / clex.md
Created December 18, 2016 02:31 — forked from SoniEx2/clex.md

ClEx - Clunky Expressions

Version 0.10.

Authors:

  • SoniEx2

About

@pablomayobre
pablomayobre / ripple.elm
Last active October 18, 2016 07:23
Simple ripple effect in elm
import Html exposing (..)
import Html.Events exposing (on)
import Html.Attributes exposing (..)
import Html.App as App
import Html.Keyed as Keyed
import Json.Decode as Json
import Mouse exposing (Position)
import List as List
import Time exposing (Time, second)
$m-colors: (
'red': (
'50': #ffebee,
'100': #ffcdd2,
'200': #ef9a9a,
'300': #e57373,
'400': #ef5350,
'500': #f44336,
'600': #e53935,
'700': #d32f2f,
@pablomayobre
pablomayobre / atom.md
Last active November 18, 2017 21:33
Atom setup to develop LÖVE apps and games

Atom

Packages

  • Comment: I use this to easily comment out lines of code. (I added support for Lua)
  • Hyperclick-LÖVE: I don't use this much but is useful to see what a function does and/or if exists. (I found this awkward so I'm not ussing it anymore)
  • Language-Lua: This is required in order to get syntax highlighting for Lua.
  • Linter-Luacheck: Luacheck helps a lot at identifying possible problems in a Lua file so this package is a MUST. I provided the LÖVE standard to Luacheck and help maintain the linter-luacheck plugin.
  • LÖVE-Atom: Add snippets for autocompletion of LÖVE functions. I help rm-code with this he is always improving it.
  • Build-LÖVE: Provides an easy way to ru
@pablomayobre
pablomayobre / Reference.lua
Last active August 28, 2016 23:21
Styled text reference
--"?" Means optional
--"*" Means 0 or more times
--"+" Means 1 or more times
--NUMBER is a valid Lua number, most of the time it should be positive and never +inf or -inf, it may be floating point
--FONT is a font for the specific engine the library is being used in (LÖVE)
--This will change in the future to use a framework agnostic type
--COLOR is a table with three or four numbers for red, green, blue and alpha, in that order and in the range of [0,255].
--Example: {0, 255, 0, 128} green with half transparency
--TEXT is a string representing the text to be drawn for that subnode
@pablomayobre
pablomayobre / .gitignore
Created April 19, 2016 23:04
My super useful cover all cases .gitignore. A .gitignore to rule them all
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
@pablomayobre
pablomayobre / Lossend.md
Last active April 5, 2016 05:13
Ttransmit words in a binary way, faster that with ASCII or similar charsets, in a lossy way

#Lossend

The idea is to transmit text faster that with morse and similar systems but still be easily understood by humans.

I'm not sure this will work really well!

Sending the data by hand is way too hard (Binary level) but that can be done by a machine, although human may get far more compression since some understanding of phonetics is needed in order to write shorter text (Character level).

Decoding the data (Letter level) using a machine, although possible, would be hard to get the original text since most of the work must be done by the human brain which can associate sounds and structures to words.