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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQINBFRQA8EBEADrLHxW4807EJMzDjhrR5+FRy5/3616nyLlbWFTLnS1/i514L7Z | |
LVzbho4eZWjErRWqT1mr+E7dr/c8Ei5J8kUMqm5MoSkCoc5Y7Gp0jKhfDF4Megpd | |
X2ZKw7VG+4GZU9gxbm+6ymHeDAFRfQjUoHzCZsdsgnhi1C58kMoY39dFidlk24AG | |
E7y8WEg42yzSyJFjK5+qdGuKTBK4UmYM3uxHbxZgBLZ1PQ9DhsToauTqQSJEFzC+ | |
r4qQeO6CeZAUEhgCt3HnmKE8hdARQelNRICrQc/Gpd3c3Wcpi3zj61cRqTCDBtNJ | |
h66bN+b6MilfT1S+9YMqLACXIWRcXPPUUWanmleguzGfngRjr/qf2PF6g2HYsp40 | |
4M3CE0JX5O5iD4A81b5duuhIzZhJu1LFyn0uPX/zHlEwo36cQF3ElbsKyX6woXpx | |
hbHf67y6oQdSivhJvshJamRHxgi+bU6kkiiY0E8L5/8h309TVpd0wXfYfMPeE+V6 |
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: ./Rakefile | |
require File.expand_path('../config/application', __FILE__) | |
Rails.application.load_tasks | |
task default: 'bundler:audit' |
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
result = 2017.times.inject(Hash.new(0)) do |res, year| | |
year.to_s.each_char do |char| | |
res[char] += 1 | |
end | |
puts "#{year} => #{res}" | |
res | |
end | |
# 0 => {"0"=>1} | |
# 1 => {"0"=>1, "1"=>1} |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click_on('Link Text') # Click either a link or a button | |
click_on('Button Value') |
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
-- Standard awesome library | |
require("awful") | |
require("awful.autofocus") | |
require("awful.rules") | |
-- Theme handling library | |
require("beautiful") | |
-- Notification library | |
require("naughty") | |
require("vicious") | |
-- Load Debian menu entries |
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
class Grouper | |
def self.group(list) | |
result = list.inject([]) do |res, gr1| | |
current_group = recursive_finder(list, gr1) | |
res << current_group | |
end | |
result | list | |
end |
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
sort_obj_by_key = (obj) -> | |
sorted = {} | |
keys = (key for own key, value of obj).sort() | |
sorted[key] = obj[key] for key in keys | |
sorted |
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
$(function() { | |
$('textarea').focus().setCursorPosition($('textarea').val().length); | |
}); | |
$.fn.setCursorPosition = function(pos) { | |
if ($(this).get(0).setSelectionRange) { | |
$(this).get(0).setSelectionRange(pos, pos); | |
} else if ($(this).get(0).createTextRange) { | |
var range = $(this).get(0).createTextRange(); | |
range.collapse(true); |
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
# Returns get parameters. | |
# | |
# If the desired param does not exist, null will be returned | |
# | |
# To get the document params: | |
# @example value = $(document).getUrlParam("paramName"); | |
# | |
# To get the params of a html-attribut (uses src attribute) | |
# @example value = $('#imgLink').getUrlParam("paramName"); | |
jQuery.fn.extend |
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
# coffeescript rules | |
# Pagination is sticked with model | |
# | |
# Server should response in that way: | |
# { | |
# articles: [{category_id:null, id:308,…}, {category_id:null, id:307,…}, {category_id:null, id:306,…},…] | |
# pagination: {total:34, page:2, per_page:15, cat_id:-1, source_id:-1} | |
# } | |
# To achieve this controller should look like (using will_paginate gem): | |
# per_page = params[:per_page].to_i || 15 |