This file contains 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
"$schema": "http://json-schema.org/draft-04/hyper-schema" | |
title: <Some title> | |
description: <Some descriotion> | |
id: <some_id> | |
links: | |
- | |
href: "<base_url>" | |
rel: self | |
This file contains 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
require 'logger' | |
require 'colored' | |
class Capistrano::BM | |
attr_writer :logger | |
def initialize | |
@logger = Logger.new(STDOUT) | |
@start_times = {} | |
@end_times = {} |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am amekss on github. | |
* I am amekss (https://keybase.io/amekss) on keybase. | |
* I have a public key whose fingerprint is C6D4 9BE7 7E7A ED2E 94D9 E9C7 5088 C3B2 22A6 CEF4 | |
To claim this, I am signing this object: |
This file contains 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
# https://gist.github.com/AMekss/8222620 | |
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n | |
lv: | |
devise: | |
confirmations: | |
confirmed: 'Jūsu lietotājs ir veiksmīgi apstiprināts. Jūs esat pieslēdzies.' | |
send_instructions: 'Pāris minūšu laikā uz Jūsu epastu tiks nosūtīts apraksts, kā apstiprināt Jūsu lietotāju.' | |
send_paranoid_instructions: 'Ja Jūsu parole eksistē mūsu datubāzē, tad pāris minūšu laikā uz Jūsu epastu tiks nosūtīts apraksts, kā apstiprināt Jūsu lietotāju.' | |
failure: |
This file contains 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 RangedHash | |
def initialize(hash={}) | |
@ranged_hash = hash | |
end | |
def [](key) | |
(@ranged_hash.detect{|range, value| range.cover?(key) } || []).last | |
end | |
def []=(key, value) |
This file contains 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
# -*- encoding : utf-8 -*- | |
class String | |
# method always returns string with valid encoding which is equal to Encoding#default_internal | |
# handy for working with strings which encoding may differ (all kinds of imports and free text inputs) | |
def normalize_encoding! | |
return self unless !!defined?(Encoding) # apply for Ruby 1.9.3 only | |
encoding_equal_to_default_internal = (self.encoding == Encoding.default_internal) | |
# return unchanged if encoding is valid and equal to default_internal |
This file contains 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
# -*- encoding : utf-8 -*- | |
module ApplicationHelper | |
def read_value_from(object, path_string, alt_value=nil) | |
return alt_value unless object && path_string | |
value = object | |
path_string.split(".").each do |path_component| | |
return alt_value unless value.respond_to?(path_component.to_sym) | |
value = value.send(path_component.to_sym) | |
end | |
value |
This file contains 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
# Source: https://gist.github.com/ceb528f97638c45ad6c7 | |
# Replacement for direct @var ||= solution but this one correctly memoize non-true values (nil, false, etc) and is simple.. | |
# Much simpler than ActiveSupport::Memoize which is deprecated (in Rails 3.2) by the way | |
module InstanceCaching | |
def remember(*args) | |
caller_name = caller(1..1).first[/`(.*)'/, 1] | |
caller_args_digest = Digest::MD5.hexdigest(args.to_s) | |
cache = @instance_caching_memoizations_aw5zdgf ||= {} | |
cache_key = "#{caller_name}_#{caller_args_digest}" |
This file contains 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
// The MIT License (MIT) => http://www.opensource.org/licenses/mit-license | |
// Copyright (c) 2012 Artūrs Mekšs | |
// | |
// Runtime depndency jQuery 1.4 or above | |
(function($, rootspace){ | |
window[rootspace] = function(namespace, object){ | |
var setNamespace = function(namespace){ | |
var root = window[rootspace]; | |
$(namespace.split(".")).each(function(idx, name){ | |
root = root[name] = root[name] || {}; |
This file contains 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
%REM | |
Copyright 2009 TietoEnator Alise (developed by Arturs Mekss) | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |