Skip to content

Instantly share code, notes, and snippets.

View lappi-lynx's full-sized avatar
🚴
Cycling from home

Stanislav Kniazev 🇺🇦 lappi-lynx

🚴
Cycling from home
View GitHub Profile
@lappi-lynx
lappi-lynx / slickgrid_autocomplete_editor.js
Last active May 17, 2017 07:30
jQuery Autocomplete editor for SlickGrid js table
function AutoCompleteEditor(args) {
var $input;
var defaultValue;
var scope = this;
var calendarOpen = false;
this.init = function () {
$input = $("<INPUT type=text class='editor-text' />");
$input.appendTo(args.container);
@lappi-lynx
lappi-lynx / ckeditor_toolbar_config.js
Last active January 29, 2016 12:18
CKeditor custom tollbar in rails 4
// Create /app/assets/javascripts/ckeditor/config.js file:
CKEDITOR.editorConfig = function( config )
{
config.toolbar = 'MyToolbar';
config.toolbar_MyToolbar =
[
{ name: 'document', items : [ 'NewPage','Preview' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
@lappi-lynx
lappi-lynx / es.sh
Last active January 29, 2016 12:17
Elastic search install
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.0.deb
sudo dpkg -i elasticsearch-1.1.0.deb
@lappi-lynx
lappi-lynx / bootstrap_breadcrumbs_builder.rb
Last active August 29, 2015 13:56
bootstrap builder for breadcrumbs_on_rails gem
# bootstrap builder for breadcrumbs_on_rails gem
class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
def render
@context.content_tag(:ul, class: 'breadcrumb') do
@elements.collect do |element|
render_element(element)
end.join.html_safe
end
end
head
title = content_for?(:title) ? yield(:title) : 'Nathaniel Paul'
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0"
meta name="description" content="#{content_for?(:description) ? yield(:description) : 'Nathaniel Paul description text'}"
meta name="keywords" content="#{content_for?(:keywords) ? yield(:keywords) : 'Nathaniel Paul, designer, emerged'}"
@lappi-lynx
lappi-lynx / gist:5758489
Created June 11, 2013 16:43
Rails group_by_day method
# Method for grouping users by the day (for postgresql):
User.order("DATE(created_at)").group("DATE(created_at)").count
@lappi-lynx
lappi-lynx / gist:4222728
Created December 6, 2012 08:25
Pagination align
$(".pagination").each ->
parent_width = $(this).parent().width()
pwidth = $(this).width()
align = (parent_width - pwidth) / 2
$(this).css "margin-left", align
@lappi-lynx
lappi-lynx / popup
Created November 30, 2012 06:57
create popup
def create_popup(discipline)
if discipline.short_description.present?
options = {:content => discipline.short_description, "original-title" => t("discipline.short_description_title"),
:trigger => "hover" }
end
content_tag(:div, :data => options ) do
discipline.name
end
end