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
# config/initializer/elasticsearch.rb | |
config = { | |
transport_options: { request: { timeout: 5 } } | |
} | |
if File.exist?('config/elasticsearch.yml') | |
template = ERB.new(File.new('config/elasticsearch.yml').read) | |
processed = YAML.safe_load(template.result(binding)) | |
config.merge!(processed[Rails.env].symbolize_keys) | |
end |
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 SendNewMessageNotifications | |
include Interactor #this is the gem | |
def call | |
Mailer.send_message(destination, message).deliver_later | |
AndroidNotification.send_message(destination, message) | |
AppleNotification.send_message(destination, message) | |
end | |
end |
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
def create | |
conversation = Conversation.find(params[:conversation_id]) | |
if message = conversation.messages.create(params) | |
Mailer.send_message(destination, message).deliver_later | |
AndroidNotification.sent_message(destination, message) | |
AppleNotification.sent_message(destination, message) | |
#render success | |
else | |
#render error | |
end |
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 MessagesController < BaseController | |
def create | |
conversation = Conversation.find(params[:conversation_id]) | |
message = conversation.messages.create(params) | |
if message.valid? | |
Mailer.send_message(destination, message).deliver_later | |
#render success | |
else | |
#render error | |
end |
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
awk 'BEGIN { for (i = 1; i <= 315; ++i) system("s3cmd --recursive modify --add-header=\"Cache-Control:public ,max-age= 31536000\" --dry-run s3://yourbucket/users/avatars/000/"sprintf("%03d", i)) }' |
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
/* | |
MIT License | |
Copyright (c) 2016 Diego Yasuhiko Kurisaki | |
*/ | |
/* Example: | |
mEmailView.addTextChangedListener(new MaskWatcher("###-##")); | |
*/ | |
import android.text.Editable; |
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
/** | |
* This binder is needed to prevent a NullPointerException cases when | |
* Android's Data Binding Library Binder class tries to bind the value | |
* for rating when the model isn't setted yet. | |
* */ | |
public class RatingBinder { | |
@BindingAdapter({"rating"}) | |
public static void setRating(RatingBar ratingBar, Float rating) { | |
if (rating != null) { | |
ratingBar.setRating(rating); |
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
//http://jsfiddle.net/r0hydxpb/2/ | |
var chart = c3.generate({ | |
data:{ | |
json:[ | |
{"key":2000,"value":100},{"key":2001,"value":200}, | |
{"key":2003,"value":300},{"key":2004,"value":400}, | |
{"key":2005,"value":500},{"key":2006,"value":600}, | |
{"key":2007,"value":700} | |
], |
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
#user nobody; | |
worker_processes 5; | |
error_log /var/log/nginx/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
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
#~/.gtkrc-2.0 | |
gtk-theme-name = "MediterraneanLight" | |
gtk-font-name = "DejaVu Sans 10" | |
gtk-icon-theme-name = "Faenza-Dark" |
NewerOlder