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
{ | |
"handlers": { | |
"graphite": { | |
"type": "amqp", | |
"exchange": { | |
"type": "topic", | |
"name": "metrics", | |
"passive": "true" | |
}, | |
"send_only_check_output": true |
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
{ | |
"rabbitmq": { | |
"port": 5672, | |
"host": "127.0.0.1" | |
}, | |
"redis": { | |
"host": "localhost", | |
"port": 6379 | |
}, | |
"api": { |
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
I want to create Task management app. Task has many assignee and one assignor. This is how I have created a association. Getting error of | |
ActiveRecord::HasManyThroughAssociationNotFoundError: Could not find the association :assignment in model User | |
class User < ActiveRecord::Base | |
attr_accessible :name | |
has_many :assignments,:foreign_key => "assignee_id" | |
has_many :tasks, :through => :assignment | |
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
<script> | |
$(document).ready(function(){ | |
var startRecording = document.getElementById('start-recording'); | |
var stopRecording = document.getElementById('stop-recording'); | |
var uploadRecordingBtn = document.getElementById('upload-recording'); | |
var cameraPreview = document.getElementById('camera-preview'); | |
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 Foo | |
def initialize(thing) | |
@thing = thing | |
end | |
def test_me | |
if @thing.big? | |
'Big!' | |
else | |
'Small!' |
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
package com.healthseva.widget; | |
import com.healthseva.R; | |
import com.healthseva.services.RandomTipService; | |
import com.healthseva.utility.ServiceUtility; | |
import android.app.PendingIntent; | |
import android.appwidget.AppWidgetManager; | |
import android.appwidget.AppWidgetProvider; | |
import android.content.ComponentName; |
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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
passenger_root /path/to/.rvm/gems/ruby-2.3.0/gems/passenger-5.0.24; | |
passenger_ruby /path/to/.rvm/gems/ruby-2.3.0/wrappers/ruby; | |
include mime.types; |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
1) ActiveModel validation in rails server side : | |
class MyObject < ActiveRecord::Base | |
validates :state, :presence => true | |
validates :other_state, :presence => true, if: state.persent? | |
end | |
2) Lets say we have drop down with following state : | |
<select id="stateDropdown" name="state"> |
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
#View original : https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb | |
class Users::RegistrationsController < Devise::RegistrationsController | |
respond_to :json | |
# POST /resource | |
def create | |
build_resource(sign_up_params) |
OlderNewer