Skip to content

Instantly share code, notes, and snippets.

<%= grid(@tasks_grid) do |g|
...
end -%>
<% selected = @tasks_grid.selected_records %>
<p><%= selected.size %> records selected: <%= selected.map(&:id).to_sentence %></p>
<%= grid(@grid) do |g|
g.blank_slate do
"There are no records"
end
g.column do |product|
...
end
end -%>
<%= grid(@grid, :table_html_attrs => {:class => 'css_class1'}) do |g|
g.column(:td_html_attrs => {:class => 'css_class2'}) do
...
end
end -%>
<%= grid(@grid, :class => 'css_class1') do |g|
g.column(:class => 'css_class2') do
end
end -%>
-module(simple_exit_demo).
-export([simple_exit_demo/0]).
simple_exit_demo() ->
spawn(fun() -> start_processes() end).
start_processes() ->
process_flag(trap_exit, true),
spawn_link(fun() -> timer:sleep(1000) end),
spawn_link(fun() -> timer:sleep(2000), exit(exiting_for_a_reason) end),
-module(kill).
-export([kill_demo/0]).
listen() ->
receive
Message -> io:format("~p has caught a system message: ~p~n~n", [self(), Message]),
listen()
after 1000 ->
io:format("I, ~p, live on~n", [self()]),
@leikind
leikind / tm2st2
Created January 16, 2012 09:12
Textmate-to-Sublime Text 2 switcher's first steps
highlight all current words ctrl+cmd+G
select all found occurrences alt-enter
full screen mode ctrl-shift-cmd-f
VIM's o cmd-return
check syntax shift-alt-v
start multiline editing from a selected area command+shift+l
highlight a current word one by one cmd-d
skip a current word one by one cmd k, cmd-d
vertical selection ALT - mouse
def generate_random_pronouncable_password(size = 3)
c = %w(b c d f g h j k l m n p qu r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr)
v = %w(a e i o u y)
f, r = true, ''
(size * 2).times do
r << (f ? c[rand * c.size] : v[rand * v.size])
f = !f
end
r
end
def screen_density diagonal_size_inches, width_pixels, height_pixels
Math.sqrt(width_pixels * width_pixels + height_pixels * height_pixels) / diagonal_size_inches
end
[
['iPhone 3GS', 3.5, 320, 480],
['Galaxy S3', 4.8, 720, 1280],
['Galaxy 7', 7, 800, 1280],
['Kindle Fire', 7, 600, 1024],
var focusElementIfNeeded, getGridProcessorForElement, initWiceGrid, setupAutoreloadsForExternalFilters, setupAutoreloadsForInternalFilters, setupCsvExport, setupDatepicker, setupExternalCsvExport, setupExternalSubmitReset, setupHidingShowingOfFilterRow, setupMultiSelectToggle, setupShowingAllRecords, setupSubmitReset;
jQuery(function() {
return initWiceGrid();
});
initWiceGrid = function() {
$(".wice-grid-container").each(function(index, wiceGridContainer) {
var dataDiv, filterDeclaration, filterDeclarations, gridName, gridProcessor, processorInitializerArguments, _fn, _i, _len;
gridName = wiceGridContainer.id;