Skip to content

Instantly share code, notes, and snippets.

@mdo
mdo / 00-intro.md
Last active June 25, 2024 18:16
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@jaimeiniesta
jaimeiniesta / rails_jobs.txt
Last active November 15, 2018 09:15
Resources to find a job as a Rails developer
The following is a list of places where you can find job offers as a Rails developer:
https://twitter.com/currofile
https://twitter.com/domestikaempleo #spain only
http://www.workingwithrails.com/
https://weworkremotely.com/jobs/search?term=rails
https://jobs.github.com/
http://trabajosrails.com/ # spain only
http://www.indeed.com/q-Ruby-On-Rails-Developer-jobs.html

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed
@ndnichols
ndnichols / buildProperties.coffee
Created November 15, 2012 17:28
A function for automatically adding getter/setters to Backbone models.
buildProperties = (func) ->
buildGetter = (name) ->
-> @get name
buildSetter = (name) ->
(value) -> @set name, value
for attr in func.prototype.attributeNames
Object.defineProperty func.prototype, attr,
get: buildGetter attr
set: buildSetter attr
@mebens
mebens / gist:3911360
Created October 18, 2012 11:57
Hz frequencies of the notes from eight octaves in a Lua table.
-- converted from http://www.seventhstring.com/resources/notefrequencies.html
notes = {
[0] = { ["c"] = 16.35, ["c#"] = 17.32, ["d"] = 18.35, ["d#"] = 19.45, ["e"] = 20.60, ["f"] = 21.83, ["f#"] = 23.12, ["g"] = 24.50, ["g#"] = 25.96, ["a"] = 27.50, ["a#"] = 29.14, ["b"] = 30.87, },
[1] = { ["c"] = 32.70, ["c#"] = 34.65, ["d"] = 36.71, ["d#"] = 38.89, ["e"] = 41.20, ["f"] = 43.65, ["f#"] = 46.25, ["g"] = 49.00, ["g#"] = 51.91, ["a"] = 55.00, ["a#"] = 58.27, ["b"] = 61.74, },
[2] = { ["c"] = 65.41, ["c#"] = 69.30, ["d"] = 73.42, ["d#"] = 77.78, ["e"] = 82.41, ["f"] = 87.31, ["f#"] = 92.50, ["g"] = 98.00, ["g#"] = 103.8, ["a"] = 110.0, ["a#"] = 116.5, ["b"] = 123.5, },
[3] = { ["c"] = 130.8, ["c#"] = 138.6, ["d"] = 146.8, ["d#"] = 155.6, ["e"] = 164.8, ["f"] = 174.6, ["f#"] = 185.0, ["g"] = 196.0, ["g#"] = 207.7, ["a"] = 220.0, ["a#"] = 233.1, ["b"] = 246.9, },
[4] = { ["c"] = 261.6, ["c#"] = 277.2, ["d"] = 293.7, ["d#"] = 311.1, ["e"] = 329.6, ["f"] = 349.2, ["f#"] = 370.0, ["g"] = 392.0, ["g#"] = 41
@eclubb
eclubb / sqlite2pg.sh
Created March 30, 2012 17:20
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
" This is only present in 7.3+
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/.vim/undo//
@ariera
ariera / README.markdown
Created August 7, 2011 16:23
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group