Skip to content

Instantly share code, notes, and snippets.

View andsve's full-sized avatar
🍎
Coding

Sven Andersson andsve

🍎
Coding
View GitHub Profile
@starwing
starwing / lua-nanovg.c
Last active August 29, 2015 13:59
NanoVG binding for Lua
#define LUA_LIB
#include "lbind.h"
#include "gl_2_0_core.h"
static int opengl_loaded = 0;
#define NANOVG_GL2_IMPLEMENTATION
#include "nanovg/src/nanovg_gl.h"
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@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()
@andsve
andsve / JSON.lua
Created March 10, 2012 14:59
BigBrother Sweden Tweet-Getter
-- -*- coding: utf-8 -*-
--
-- Copyright 2010-2011 Jeffrey Friedl
-- http://regex.info/blog/
--
local VERSION = 20111207.5 -- version history at end of file
local OBJDEF = { VERSION = VERSION }
--
-- Simple JSON encoding and decoding in pure Lua.
module("modules/imgcache2/imgcache2")
function parse_message(bot, msg)
local i,j,chan,s = string.find(msg, ":.-!.- PRIVMSG (.-) :(.+)")
if not (i == nil) then
function db_connect()
local luasql = require("luasql.sqlite3")
local env = luasql.sqlite3()
local conn = env:connect("imgcache2.sqlite")
module("modules/imgcache/imgcache")
function get_image(url)
local socket = require("socket")
-- get host and path
local socketurl = require("socket.url")
local parsedurl = socketurl.parse(url)
local host = parsedurl.host
module("modules/xb/xb")
function parse_message(bot, msg)
local i,j,chan,n = string.find(msg, ":.-!.- PRIVMSG (.-) ::xb (.+)")
if not (i == nil) then
local http = require("socket.http")
local b, c, h = http.request("http://profile.mygamercard.net/" .. tostring(n))
if not (b == nil) then
module("modules/wp/wp")
function parse_message(bot, msg)
local i,j,sender,chan,q = string.find(msg, ":(.-)!.- PRIVMSG (.-) :" .. bot.config.triggerprefix .. "wp (.+)")
if not (i == nil) then
if not (string.sub(chan, 1, 1) == "#") then
chan = sender
end
Afrikaans -> af
Albanian -> sq
Arabic -> ar
Armenian -> hy
Azerbaijani -> az
Basque -> eu
Belarusian -> be
Bulgarian -> bg
Catalan -> ca
Chinese (Simplified) -> zh-CN
module("modules/tr/tr")
function parse_message(bot, msg)
local i,j,sender,chan,q = string.find(msg, ":(.-)!.- PRIVMSG (.-) :" .. tostring(bot.config.triggerprefix) .. "tr(.*)")
if not (i == nil) then
if not (string.sub(chan, 1, 1) == "#") then
chan = sender
end