Skip to content

Instantly share code, notes, and snippets.

View resize_iframe_height.js
// Resize iframe height
jQuery(function(){
var iframes = $('iframe.resize-to-max-height');
var pageY = function (elem) {
return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
}
if (iframes.length){
@leikind
leikind / view_column_sophia_date.rb
Created Feb 19, 2014
minimalistic WG ViewColumnDate processor
View view_column_sophia_date.rb
# {
# "docs"=>
# {
# "f"=>
# {
# "document_date"=>
# {
# "fr"=>"2014-02-07",
# "to"=>"2014-02-21"
# },
View elasticsearch_client.rb
require 'elasticsearch'
require 'base64'
class SimpleElastic
def initialize(log = false)
@client = Elasticsearch::Client.new log: log
@index = 'sophiaindex'
@type = 'sophiadocument'
end
@leikind
leikind / bin2dec.exs
Created Oct 31, 2014
Binary to decimal
View bin2dec.exs
defmodule Bin2Dec do
import List, only: [duplicate: 2]
import Enum
def bin2dec(bin) when is_binary(bin) do
bin
|> String.codepoints
|> reverse
@leikind
leikind / total_entries of will_paginate and WiceGrid.md
Created Jan 4, 2015
:total_entries of will_paginate and WiceGrid
View total_entries of will_paginate and WiceGrid.md

NOVEMBER 11, 2009

will_paginate normally runs 2 SQL queries - one to retrieve a limited number of records, and one to count all records. To avoid the second COUNT query one can submit parameter :total_entries to method paginate. Today :total_entries was also added to parameters of initialize_grid in order to be able to use this functionality of will_paginate.

View SproutCore.md

APRIL 21, 2010

To celebrate the release of SproutCore version 1.0 I have worked through their tutorial building a simple ToDo application.

Well. Impressive. The people behind it do know how Cocoa works and managed to take its MVC to the web.

The backend becomes a simple RESTful data provider implementing CRUD's for models, via JSON by default, but it can be any other data format. I used Rails as the backend, but really, Rails as a SproutCore backend seems an overkill - half of the Rails stack is not used. Sinatra with ActiveRecord feels more appropriate.

The only thing is that writing a DataSource, a class responsible for the communication with the backend, requires a bit too much code, more verbose that the code for models, views, and controllers.

@leikind
leikind / WiceGrid examples.md
Last active Aug 29, 2015
WiceGrid examples
View WiceGrid examples.md
@leikind
leikind / Wice Assignment Lists version 0.2.md
Last active Aug 29, 2015
Wice Assignment Lists version 0.2
View Wice Assignment Lists version 0.2.md
@leikind
leikind / What OSes Russian speaking Rails developers use.md
Last active Aug 29, 2015
What OSes Russian speaking Rails developers use
View What OSes Russian speaking Rails developers use.md

JULY 14, 2010

Recently in a mailing list for Russian speaking Rails developers a survey took place on what OSes are used for development, and what OSes run on servers that the developers deploy to.

Here are the results:

Development

  • 34 OS X
  • 30 Ubuntu
@leikind
leikind / What I spent my Sunday evening on.md
Created Jan 4, 2015
What I spent my Sunday evening on...
View What I spent my Sunday evening on.md

DECEMBER 06, 2009

WiceGrid is now compatible with the new Rails XSS behavior which will be default in Rails 3.0 and is available in Rails 2.3.5 with the help of the rails_xss plugin.

WiceGrid has started using merge_conditions to process conditions, and conditions can be in any format processable by ActiveRecord, including hashes of hashes. An intentional side effect of this is that WiceGrid does not support Rails older than 2.1.0.