Skip to content

Instantly share code, notes, and snippets.

View tagrudev's full-sized avatar

Todor Grudev tagrudev

View GitHub Profile
module Bdz
module Serializable
def as_hash
hash = {}
self.instance_variables.each do |var|
hash[var.to_s.gsub("@", "")] = self.instance_variable_get var
end
hash
end
end
Gradle: [Fatal Error] :63:10: The content of elements must consist of well-formed character data or markup.
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':MYAPP:generateDebugBuildConfig'.
> No value has been specified for property 'packageName'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
["{\"id\":\"8626\",\"type\":\"БВ\",\"leaves\":\"03:34:00\",\"arrives\":\"06:11:00\"}","{\"id\":\"1620\",\"type\":\"БВ\",\"leaves\":\"06:00:00\",\"arrives\":\"08:40:00\"}","{\"id\":\"10110\",\"type\":\"ПВ\",\"leaves\":\"06:35:00\",\"arrives\":\"10:20:00\"}","{\"id\":\"1622\",\"type\":\"БВ\",\"leaves\":\"07:00:00\",\"arrives\":\"09:35:00\"}","{\"id\":\"8640\",\"type\":\"БВ\",\"leaves\":\"08:00:00\",\"arrives\":\"10:30:00\"}","{\"id\":\"10112\",\"type\":\"ПВ\",\"leaves\":\"12:00:00\",\"arrives\":\"15:27:00\"}","{\"id\":\"8610\",\"type\":\"БВ\",\"leaves\":\"12:20:00\",\"arrives\":\"14:51:00\"}","{\"id\":\"1624\",\"type\":\"БВ\",\"leaves\":\"13:00:00\",\"arrives\":\"15:40:00\"}","{\"id\":\"10114\",\"type\":\"ПВ\",\"leaves\":\"14:00:00\",\"arrives\":\"17:29:00\"}","{\"id\":\"8602\",\"type\":\"БВ\",\"leaves\":\"17:00:00\",\"arrives\":\"19:30:00\"}","{\"id\":\"10116\",\"type\":\"ПВ\",\"leaves\":\"17:15:00\",\"arrives\":\"20:28:00\"}","{\"id\":\"1626\",\"type\":\"БВ\",\"leaves\":\"18:00:00\",\"arrives\":\"20:38:00\"}"
["{\"id\":\"8626\",\"type\":\"БВ\",\"leaves\":\"03:34:00\",\"arrives\":\"06:11:00\"}","{\"id\":\"1620\",\"type\":\"БВ\",\"leaves\":\"06:00:00\",\"arrives\":\"08:40:00\"}","{\"id\":\"10110\",\"type\":\"ПВ\",\"leaves\":\"06:35:00\",\"arrives\":\"10:20:00\"}","{\"id\":\"1622\",\"type\":\"БВ\",\"leaves\":\"07:00:00\",\"arrives\":\"09:35:00\"}","{\"id\":\"8640\",\"type\":\"БВ\",\"leaves\":\"08:00:00\",\"arrives\":\"10:30:00\"}","{\"id\":\"10112\",\"type\":\"ПВ\",\"leaves\":\"12:00:00\",\"arrives\":\"15:27:00\"}","{\"id\":\"8610\",\"type\":\"БВ\",\"leaves\":\"12:20:00\",\"arrives\":\"14:51:00\"}","{\"id\":\"1624\",\"type\":\"БВ\",\"leaves\":\"13:00:00\",\"arrives\":\"15:40:00\"}","{\"id\":\"10114\",\"type\":\"ПВ\",\"leaves\":\"14:00:00\",\"arrives\":\"17:29:00\"}","{\"id\":\"8602\",\"type\":\"БВ\",\"leaves\":\"17:00:00\",\"arrives\":\"19:30:00\"}","{\"id\":\"10116\",\"type\":\"ПВ\",\"leaves\":\"17:15:00\",\"arrives\":\"20:28:00\"}","{\"id\":\"1626\",\"type\":\"БВ\",\"leaves\":\"18:00:00\",\"arrives\":\"20:38:00\"}"
simple_form_for(@object) do |f|
# this is an input for a name
f.input :name
# i want just an input for an autocompleter that has nothing to do with the @object
f.input
$(document).ready ->
mapOptions =
center: new google.maps.LatLng(-34.397, 150.644)
zoom: 8
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map $("#venues_map_canvas").get(0), mapOptions
private
def play_games
Game.unscoped.where(:state => "active", :start_at.lt => Time.zone.now).each do |game|
game.play
end
end
@tagrudev
tagrudev / gist:5371797
Last active December 16, 2015 03:39
Conversation Flow // Mongoid
class Conversation
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :participants, :class_name => 'User', inverse_of: :conversations
embeds_many :messages, :class_name => 'Message'
end
@tagrudev
tagrudev / gist:5371199
Last active December 16, 2015 03:39
Followers/Following
$(document).ready ->
$("#following_option").on "ajax:complete", (evn, data) ->
$("#following_option").html(data.responseText)
= resource.comments.each do |comment|
%br
= comment.text