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
connection.execute <<-SQL | |
CREATE MATERIALIZED VIEW last_current_metadata AS | |
SELECT id, hour_start, distance, last_time, max_speed, all_data_records, current_data_record, gl.gps_logger_metadata_item_id | |
FROM gps_logger_current_data_items gl | |
INNER JOIN ( | |
SELECT gps_logger_metadata_item_id, MAX(hour_start) AS max_hour_start | |
FROM gps_logger_current_data_items | |
GROUP BY gps_logger_metadata_item_id | |
) ingl ON ingl.gps_logger_metadata_item_id = gl.gps_logger_metadata_item_id AND ingl.max_hour_start = gl.hour_start | |
SQL |
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
task duplicate_imei: :environment do | |
Company.active.each do |company| | |
begin | |
SwitchTenant.switch!(company.tenant) | |
duplicate_imei_ids = [] | |
GpsLoggerMetadataItem.select(:id, :imei).each do |l| | |
duplicate_imei_ids << GpsLogger.find_by(imei: l.imei).id if GpsLogger.where(imei: l.imei).size > 1 | |
end | |
unless duplicate_imei_ids.blank? |
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
description "A test job file for experimenting with Upstart" | |
author "Andrii Rabinyuk" | |
respawn | |
respawn limit unlimited | |
start on runlevel [2345] or started postgresql | |
stop on runlevel [016] or stopping postgresql |
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 MachineMapsBoard < BasicBoard | |
def machines | |
@machines ||= machines_in_regions.find_all do |m| | |
m.was_available_in_time_range(from_date: from_time.to_date, | |
to_date: to_time.to_date) | |
end | |
end | |
def selected_machine_groups | |
if machine_groups_ids.any? |
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 Scraper | |
def self.scrape_reviewer_profile_url | |
User.find_each do |user| | |
next unless user.amazon_profile_url || !user.amazon_profile_url.blank? | |
begin | |
browser = Watir::Browser.new :firefox | |
browser.goto user.amazon_profile_url | |
sleep 2 | |
browser.span(class: 'a-expander-prompt').click |
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
require 'rubygems' | |
require 'selenium-webdriver' | |
LOGIN = "me@danielsim.co.uk" | |
PASSWORD = "***" | |
DOMAINS = ["example1.myshopify.com", "example2.myshopify.com"] | |
CUSTOM_MESSAGE = "custom message" | |
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
window.Components = window.Components || {}; | |
window.Components.Telematics = Components.Telematics || {}; | |
window.Components.Telematics.Sensor = Components.Telematics.Sensor || {}; | |
Components.Telematics.Sensor.Chart = React.createClass({ | |
_tooltip: function(props){ | |
this._tooltipFactory = this._tooltipFactory || React.createFactory(Components.Telematics.Sensor.Tooltip); | |
return this._tooltipFactory(props); | |
}, | |
_callTooltipHandler: 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
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
const { set, get } = Ember; | |
export default DS.JSONAPISerializer.extend({ | |
serialize: function(snapshot, options) { | |
let json = this._super(snapshot, options); | |
const targetImagingAttributes = get(json, 'data.attributes.target-imaging-attributes'); |
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
сlass WebhooksController < ApplicationController | |
skip_before_action :authenticate_user! | |
skip_before_action :verify_authenticity_token | |
def create | |
payload = request.body.read | |
sig_header = request.env['HTTP_STRIPE_SIGNATURE'] | |
event = nil | |
begin |