This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook 'ntp' | |
cookbook 'timezone', '0.0.1' | |
cookbook "monit", | |
:github => "apsoto/monit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Initialize the luerl state | |
Lua0 = luerl:init(), | |
%% Create a new empty table | |
{HttpTable, Lua1} = luerl_emul:alloc_table(Lua0), | |
%% Set the empty table to the global key `http` | |
Lua2 = luerl_emul:set_global_key(<<"http">>, HttpTable, Lua1), | |
%% You can also set up the global table from Lua |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
$mapping = { | |
format: :invalid, | |
not_present: :blank, | |
not_numeric: :not_a_number, | |
not_url: :invalid, | |
not_email: :invalid, | |
not_valid: :inclusion, | |
not_in_range: :inclusion, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en: | |
activemodel: &activemodel | |
errors: | |
messages: | |
inclusion: "is not included in the list" | |
exclusion: "is reserved" | |
invalid: "is invalid" | |
confirmation: "doesn't match confirmation" | |
accepted: "must be accepted" | |
empty: "can't be empty" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% File : hello_table.erl | |
%% Purpose : Demonstration of luerl:table. | |
%% Use $ erlc hello_table.erl && erl -pa ../../ebin -s hello_table run -s init stop -noshell | |
-module(hello_table). | |
-export([run/0]). | |
run() -> | |
LuaScript = <<"hello_table = { hello=\"world\" }; return table;">>, | |
{_Val, Lua0} = luerl:do(LuaScript), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1> luerl:load(<<"table = { hello=\"world\" }; return table">>). | |
{ok,{code,[{fdef,1,0,1, | |
[{push_lit,<<"hello">>}, | |
{push_lit,<<"world">>}, | |
{load_lit,[]}, | |
{build_tab,1,0.0}, | |
{store_gvar,<<"table">>}, | |
multiple, | |
{return,1}]}], | |
{cst}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table: 0x7fe851c06b50 | |
hello | |
table: 0x7fe851c06b50 | |
hello hello2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ benchmark git:(benchmark) ✗ make | |
erlc -I ../../src benchmarks.erl | |
erl -pa ../../ebin -s benchmarks run -s init stop -noshell | |
suites/accum.lua ms | |
ipairs.................. 1617.325 | |
next.................... 2649.867 | |
numeric_for............. 1591.269 | |
numeric_while........... 2686.428 | |
pairs................... 1624.004 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(luerl_table_function). | |
-export(run/0). | |
%% Get table or table key | |
%% luerl:table(Fpath, Lua) -> {ok, Value} | |
%% Set table or table key | |
%% luerl:table(Fpath, Value, Lua) -> {ok, Lua} | |
run() -> | |
Lua0 = luerl:init(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fog/vcloud' | |
# connect to cloud | |
connection = Vcloud::Compute.new( | |
:vcloud_host => 'vcloud.moc', | |
:vcloud_username => 'username', | |
:vcloud_password => 'password' | |
) | |
# virtual image template |