Skip to content

Instantly share code, notes, and snippets.

View mason-larobina's full-sized avatar

Mason Larobina mason-larobina

  • Western Australia
  • 08:57 (UTC +08:00)
View GitHub Profile
@mason-larobina
mason-larobina / autozoom.lua
Created March 29, 2011 16:12
Auto save/apply zoom levels on a per-domain basis
--------------------------------------------------------
-- Auto save/apply zoom levels on a per-domain basis --
-- (C) 2011 Roman Leonov <[email protected]>         --
-- (C) 2011 Mason Larobina <[email protected]> --
--------------------------------------------------------
-- Get lua environment
local math = require "math"
local tonumber = tonumber
local string = string
@mason-larobina
mason-larobina / gist:855103
Created March 4, 2011 17:02
Sub-100 line browser using luakit
#!/usr/bin/luakit -c
--------------------------------------------------------------------
-- 2011 (C) Mason Larobina <[email protected]> --
-- Browser in under 128 lines of code? (my attempt) --
-- See: http://lateral.netmanagers.com.ar/weblog/posts/BB948.html --
--------------------------------------------------------------------
local homepage = "http://luakit.org/"
-- Create the browser window
@mason-larobina
mason-larobina / autopager.lua
Created January 8, 2011 06:27
Autopager library for luakit
local ready_views = setmetatable({}, { __mode = "k" })
local go_next = [=[
(function() {
var el = document.querySelector("[rel='next']");
if (el) { // Wow a developer that knows what he's doing!
location = el.href;
}
else { // Search from the bottom of the page up for a next link.
var els = document.getElementsByTagName("a");
@mason-larobina
mason-larobina / autoscroll.lua
Created December 3, 2010 03:35
Autoscrolling script for luakit
----------------------------------------------------------------
-- Simple autoscroll script for luakit (luakit.org) --
-- Install instructions: --
-- 1. Add to rc.lua before window spawning code. --
-- 2. Or: save to $XDG_CONFIG_HOME/luakit/autoscroll.lua and --
-- add `require "autoscroll"` to your rc.lua --
----------------------------------------------------------------
local buf, key = lousy.bind.buf, lousy.bind.key