Skip to content

Instantly share code, notes, and snippets.

View Ismoh's full-sized avatar
🐔
bwok bwok bwokaaak

Torben H. Ismoh

🐔
bwok bwok bwokaaak
View GitHub Profile
@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@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()
@rxaviers
rxaviers / gist:7360908
Last active June 15, 2024 20:43
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@gitaarik
gitaarik / git_submodules.md
Last active June 13, 2024 21:34
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@HoraceBury
HoraceBury / tablelib.lua
Last active May 30, 2023 05:49
Lua table extensions used to improve and expand the table.* library in a simple manner.
-- table library extensions
if (dump == nil) then
dump = function(t)
print("=============")
for k,v in pairs(t) do
print("\t",k,v)
end
print("=============")
end
@fasterthanlime
fasterthanlime / oh-god-windows.md
Last active December 24, 2022 22:46
Getting rock 0.9.9 to make 32-bit binaries with MSYS2 on Windows

It seems the command-line toolchain of choice changes every fortnight on Windows (except if you're in the MSVC camp, but that's a no-go for ooc at the time of this writing).

The new kid on the block is msys2, which I first had doubts about, but it turns out it's a great way to get a shell, install the packages you need via pacman (!) and get started with ooc on windows.

MSYS2 32-bit

@soulik
soulik / os_name.lua
Created May 12, 2015 18:23
OS type and CPU architecture detection in Lua language
local function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
for idx = 1, 5 do repeat
print(1)
print(2)
print(3)
do break end -- goes to next iteration of for
print(4)
print(5)
until true end
@RyanPattison
RyanPattison / ordered_table.lua
Last active January 29, 2023 16:01
Ordered table for Lua. A table that keeps track of the order that keys are added and makes pairs iterate in order of insertion. Also, it maintains/reports the correct number of items in the table with the `#` operator.
local ordered_table = {}
--[[
This implementation of ordered table does not hold performance above functionality.
It invokes a metamethod `__newindex` for every access, and
while this is not ideal performance wise, the resulting table behaves very closely to
a standard Lua table, with the quirk that the keys are ordered by when they are first seen
(unless deleted and then reinserted.)
--]]
-- private unique keys
@corny
corny / lua-udp.lua
Created July 4, 2016 16:08
Lua UDP example
#!/usr/bin/env lua5.2
--
-- apt install lua5.2 lua-socket
--
local socket = require("socket")
local udp = assert(socket.udp())
local data
udp:settimeout(1)