Skip to content

Instantly share code, notes, and snippets.

View britzl's full-sized avatar
💭
Making Defold even better!

Björn Ritzl britzl

💭
Making Defold even better!
View GitHub Profile
@dapetcu21
dapetcu21 / style-guide.md
Created April 27, 2018 14:28
Interrogation Style Guide

Lua style guide

Linting

This project makes use of [Luacheck] for catching common mistakes. Install it and configure it for your text editor.

Editor configuration

We recommend [Atom] for editing Lua code along with the following packages:

  • [linter-luacheck]: [Luacheck] integration
@mathiaswking
mathiaswking / android_deploy.sh
Last active June 18, 2019 07:24
Deploys an .apk to the USB connected Android device. Starts the app, and grabs the logging events for that PID
#!/usr/bin/env bash
#set -e
PACKAGE=$1
if [ -z "$PACKAGE" ]; then
echo "You must pass a .apk as input!"
exit 1
fi
@chaosddp
chaosddp / FixedWindow.lua
Created May 2, 2017 10:35
Call a win32 api to make the window size cannot be changed in Defold engine, as it using LuaJIT on Windows
local ffi = package.preload.ffi()
if(ffi.os == "Windows") then
-- definitions
ffi.cdef([[
typedef unsigned int LONG;
typedef long long LONG_PTR;
typedef void* PVOID;
typedef PVOID HANDLE;
@ericroy
ericroy / ntp.lua
Last active April 30, 2017 01:32
NTP time check using lua socket
-- Most of this came from the blog article here:
-- https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html
-- For reference, the packet structure looks like:
--[[
typedef struct
{
unsigned li : 2; // Only two bits. Leap indicator.
unsigned vn : 3; // Only three bits. Version number of the protocol.
unsigned mode : 3; // Only three bits. Mode. Client will pick mode 3 for client.
@starius
starius / filter.lua
Created June 16, 2015 14:36
filter.lua - pipe of applications of Lua methods
-- Usage:
-- filter = require 'filter'
-- command = filter.lower.trim:split(' ')
-- command(input) --> input:lower():trim():split(' ')
-- command(input2) --> input2:lower():trim():split(' ')
local unpack = unpack or table.unpack
local function makeFilter(func, parent_f, parent, method_name)
return setmetatable({}, {
@panzi
panzi / portable_endian.h
Last active April 18, 2024 20:59
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()