Skip to content

Instantly share code, notes, and snippets.

// 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 February 19, 2014 12:59
minimalistic WG ViewColumnDate processor
# {
# "docs"=>
# {
# "f"=>
# {
# "document_date"=>
# {
# "fr"=>"2014-02-07",
# "to"=>"2014-02-21"
# },
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 October 31, 2014 09:24
Binary to decimal
defmodule Bin2Dec do
import List, only: [duplicate: 2]
import Enum
def bin2dec(bin) when is_binary(bin) do
bin
|> String.codepoints
|> reverse
@leikind
leikind / t.md
Last active August 29, 2015 14:12
Test

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.

@leikind
leikind / WiceGrid_Version_3.4.0.md
Last active August 29, 2015 14:12
WiceGrid Version 3.4.0

OCTOBER 11, 2013

WiceGrid version 3.4.0 has been released.

Changelog

Version 3.4.0 of WiceGrid works with Rails 4 without any changes to the API.

However, Rails 4 produces the following deprecation message:

@leikind
leikind / WiceGrid version 3.3.0.md
Last active August 29, 2015 14:12
WiceGrid version 3.3.0

AUGUST 04, 2013

WiceGrid version 3.3.0 has been released.

Changelog

  1. The with_paginated_resultset callback receives an ActiveRelation object, not a lambda
  2. Wice::Defaults::DATEPICKER_YEAR_RANGE added to the config to define the default year range in Datepicker (leikind/wice_grid#61)
  3. Improvement of the javascript calendar control: if the FROM field is set to a value after TO, TO is set to the value of FROM. Vice versa: if the TO field is set to a value before FROM, FROM is set to the value of TO
  4. New view helpers filter_and_order_state_as_hash(grid) and filter_state_as_hash(grid)
@leikind
leikind / WiceGrid examples.md
Last active August 29, 2015 14:12
WiceGrid examples
@leikind
leikind / WiceGrid got an Ohloh review.md
Created January 4, 2015 22:53
WiceGrid got an Ohloh review :)