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
Vetdata::EndpointExtractor.each(:animal, :past_day) do |animal_data, installation| | |
animal_data = AnimalTransform.call(animal_data, installation) | |
AnimalChangesetCreator.call(animal_data) | |
end | |
class AnimalTransform | |
def self.call(animal_data, installation) | |
{ |
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
function refreshDataClip() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var urlCell = sheet.getRange('A1'); | |
var cellFormula = urlCell.getFormula(); | |
var documentProperties = PropertiesService.getDocumentProperties(); | |
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
Authentication: pass your api token in the 'X-ACCESS-TOKEN' request header, or in the 'api_token' parameter | |
Create a user | |
POST | |
onboardiq.com/api/v1/applicants | |
Required attributes: [name, email, phone] | |
Email must be valid and unique |
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 Api::V1::BaseController < ApplicationController | |
respond_to :json | |
before_action :authenticate! #make this the default, then you could use skip_before_action on an action you don't need it | |
def authenticate! | |
load_account || access_denied | |
end | |
def access_denied |
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 AccountsController < ApplicationController | |
layout 'admin' | |
inherit_resources | |
#TODO: even if admin, it denies access. | |
load_and_authorize_resource :except => [:dashboard, :new, :create, :plans, :canceled, :thanks] | |
before_filter :authenticate_user!, :except => [ :new, :create, :plans, :canceled, :thanks] | |
before_filter :authorized?, :except => [ :new, :create, :plans, :canceled, :thanks] | |
before_filter :build_user, :only => [:new, :create] | |
before_filter :load_billing, :only => [ :billing, :paypal ] |
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 implementation takes one recent, one from same project, one from same language, but code is awful ######## | |
recommended = [] | |
user = post.user | |
posts = user.posts.published.ordered | |
#project | |
recommended += posts.where(repository_id: post.repository_id).not_in(recommended.map(&:id) + [post.id]) |
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 CreateQuizzes < ActiveRecord::Migration | |
def change | |
create_table :quiz_questions do |t| | |
t.integer :quiz_id | |
t.string :format, :default => 'MultiChoice' #MultiChoice, MultiSelect, or Field | |
t.string :answer, array: true, default: [] | |
t.string :options, array: true, default: [] | |
t.timestamps | |
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
class User < ActiveRecord::Base | |
has_many :github_events | |
has_many :twitter_events | |
def events | |
#help: github + twitter | |
end | |
end |