// Only rebuild menus when necessary
if (updated.settings || updated.closedFrames) {
let historyMenu = menuUtil.getParentMenuDetails(appMenu, locale.translation('history'))
if (historyMenu && historyMenu.menu && historyMenu.menu.submenu && historyMenu.index !== -1) {
const menu = historyMenu.menu.submenu
const menuItems = createHistorySubmenu(CommonMenu)
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 Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| 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
| # Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
| # the mechanics, not a real-world use case. | |
| # == DEFINITIONS | |
| # - A Taxi is a car for hire. A taxi has_many :passengers. | |
| # - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. | |
| class Taxi < ActiveRecord::Base | |
| # This scope LEFT JOINs the Passenger table. You might use this if you wanted | |
| # to select taxis by a set of taxi and passenger IDs (as with the |
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
| map = { | |
| "Some Key" => :some_other_key | |
| } | |
| data = { | |
| "Some Key" => 12345678910 | |
| } | |
| Hash.new.tap do |new_hash| | |
| map.each do |k,v| |
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
| # Put this in your Rails app's lib/tasks directory | |
| namespace :db do | |
| desc "Fix 'ERROR: must be owner of extension plpgsql' complaints from Postgresql" | |
| task :fix_psql_dump do |task| | |
| filename = ENV['DB_STRUCTURE'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "structure.sql") | |
| sql = File.read(filename) | |
| sql.sub!(/(CREATE EXTENSION IF NOT EXISTS plpgsql)/, '-- \1') | |
| sql.sub!(/(COMMENT ON EXTENSION plpgsql)/, '-- \1') | |
| File.open(filename, 'w') do |f| | |
| f.write(sql) |
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
| // Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
| $ git ls-files | xargs wc -l |