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
weekly_performance_reviews_controller.rb | |
class WeeklyPerformanceReviewsController < InheritedResources::Base | |
before_action :set_weekly_performance_review, only: [:show, :edit, :update, :destroy] | |
before_action :authenticate_admin! | |
def index | |
@weekly_performance_reviews = WeeklyPerformanceReview.all | |
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
class Employee < ActiveRecord::Base | |
has_many :subordinates, class_name: "Employee", foreign_key: "manager_id" | |
belongs_to :manager, class_name: "Employee" | |
belongs_to :team | |
has_one :team, foreign_key: "manager_id" | |
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
# see https://github.com/ankane/blazer for more info | |
data_sources: | |
main: | |
url: <%= ENV["BLAZER_DATABASE_URL"] %> | |
# statement timeout, in seconds | |
# applies to PostgreSQL only | |
# none by default | |
# timeout: 15 |
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
def prev | |
JobQueue.where(["queue_owner = ? and queue_name = ? and id < ?", queue_owner, queue_name, id]).last | |
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
# Load DSL and Setup Up Stages | |
require 'capistrano/setup' | |
require 'capistrano/deploy' | |
require 'capistrano/rails' | |
require 'capistrano/bundler' | |
require 'capistrano/rvm' | |
require 'capistrano/puma' | |
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. |
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
jQuery -> | |
jobs = $('#job_queue_id').html() | |
console.log(jobs); | |
$('#project_queue_id').change -> | |
project = $('#project_queue_id :selected').text() | |
options = $(jobs).filter("optgroup[label='#{project}']").html | |
if options | |
$('#job_queue_id').html(options) | |
else | |
$('#job_queue_id').empty() |
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
$(document).ready -> | |
cities = $('#person_city_id').html() | |
# console.log(cities) | |
$('#person_country_id').change -> | |
country = $('#person_country_id :selected').text() | |
options = $(cities).filter("optgroup[label='#{country}']").html() | |
# console.log(options) | |
if options | |
$('#person_city_id').html(options) | |
else |
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
<%= form_for(@person) do |f| %> | |
<% if @person.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2> | |
<ul> | |
<% @person.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
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 testClosure (){ | |
var x = 4; | |
function closeX(){ | |
return x; // NB: x is not stored anywhere in the innermost function its a global variable | |
} | |
return closeX; | |
} | |
var checkLocalX = testClosure(); |
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 testClosure (){ | |
var x = 4; // local variable | |
return x; | |
} | |
testClosure(); // this will return 4 | |
x; // will return undefined because a function variable are not available once the scope has closed |
OlderNewer