Skip to content

Instantly share code, notes, and snippets.

View gregblake's full-sized avatar
👨‍💻

Greg Blake gregblake

👨‍💻
View GitHub Profile
@gregblake
gregblake / mdm_upload.sh
Created June 6, 2018 16:24
POST request from Jenkins to the Nitro MDM, as part of the Android build process in CI
****************************
* Upload to Nitro MDM *
****************************
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 17.3M 0 0 100 17.3M 0 16.8M 0:00:01 0:00:01 --:--:-- 16.8M
100 17.3M 0 94 100 17.3M 61 11.4M 0:00:01 0:00:01 --:--:-- 11.4M
{
@gregblake
gregblake / gist:5dea0e6b2e84da3cfb9606a3b3427626
Created June 7, 2018 23:25
MDM POST request -- build 773
****************************
* Upload to Nitro MDM *
****************************
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
78 17.3M 0 0 78 13.5M 0 32.1M --:--:-- --:--:-- --:--:-- 32.1M
100 17.3M 0 0 100 17.3M 0 8737k 0:00:02 0:00:02 --:--:-- 8742k
100 17.3M 0 85 100 17.3M 34 7192k 0:00:02 0:00:02 --:--:-- 7190k
@gregblake
gregblake / connect_server_frequency.rb
Created June 12, 2018 14:30
Connect server frequency
require 'descriptive_statistics' # https://github.com/thirtysixthspan/descriptive_statistics
require 'csv'
csv_text = File.read('/Users/greg/Downloads/1528750652_5118.csv');
csv = CSV.parse(csv_text, :headers => true);
start_date = Date.parse("2018-06-04")
end_date = Date.parse("2018-06-09")
date_range = start_date..end_date
@gregblake
gregblake / rpush.rb
Last active March 10, 2023 13:13
Push Notifications from the Rails console
Rpush.embed # to deliver push notifications in the Rails console on notification save
# Selecting the mobile device that'll receive the notification:
greg = User.find_by(login: "greg.blake");
devices = greg.mobile_devices;
@mobile_device = greg.mobile_devices.last;
# Sending a notification to the device
n = Rpush::Apns2::Notification.new;
n.app = @mobile_device.app;
@gregblake
gregblake / feature_template.md
Created August 21, 2018 21:15
Jeremy's Feature Template

Intent

How does it work now?

How should it work?

When should it ship to production?

  • This feature can be merged to master and ship to production when it's ready.
@gregblake
gregblake / media_gallery.sh
Created September 10, 2018 12:38
Before and after adding caching to the media_gallery endpoint
@gregblake
gregblake / pr.md
Created September 19, 2018 15:20
Description for PR #9517 (moving the Connect API endpoints from NCT to Connect Component, and adding the V4 namespace)

What's this PR do?

Adds the V4 Connect API endpoints to the Connect component.

Any background context you want to provide?

This PR introduces the V4 Connect API endpoints.

There are three main changes on this branch:

@gregblake
gregblake / connect_room.diff
Last active September 24, 2018 20:35
Setting the url using `locals`
16:30 $ git diff /Users/greg/code/nitro-web/components/connect/app/views/connect/rooms/_form.html.erb
diff --git a/components/connect/app/views/connect/rooms/_form.html.erb b/components/connect/app/views/connect/rooms/_form.html.erb
index a85a953896..9621acddd8 100644
--- a/components/connect/app/views/connect/rooms/_form.html.erb
+++ b/components/connect/app/views/connect/rooms/_form.html.erb
@@ -1,6 +1,6 @@
<div class="row">
<div class="nitro-form">
- <%= nitro_form_for @connect_room, url: connect.room_path(@connect_room), html: { class: "form-horizontal" } do |f| %>
+ <%= nitro_form_for @connect_room, url: url, html: { class: "form-horizontal" } do |f| %>
@gregblake
gregblake / webpack.config.js
Created September 28, 2018 14:10
NODE_ENV=production node_modules/@powerhome/nitro_react/node_modules/.bin/webpack --config webpack.config.js
10:02 $ NODE_ENV=production node_modules/@powerhome/nitro_react/node_modules/.bin/webpack --config webpack.config.js
module.js:529
throw err;
^
Error: Cannot find module '/Users/greg/code/nitro-web/webpack.config.js'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
@gregblake
gregblake / demo13.rb
Created October 2, 2018 18:58
InfluxDb records on demo13
irb(main):002:0> GalleryMetric::Influx.gallery_views(start_date: (Date.today - 30.days), end_date: Date.today, territory_ids: Territory.pluck(:id))
=> [{"name"=>"media_gallery_viewed", "tags"=>{"estimate_appointment_id"=>"", "user_id"=>"39973"}, "values"=>[{"time"=>"2018-09-02T00:00:00Z", "count"=>88, "sum"=>59572.02978897095}]}, {"name"=>"media_gallery_viewed", "tags"=>{"estimate_appointment_id"=>"", "user_id"=>"40263"}, "values"=>[{"time"=>"2018-09-02T00:00:00Z", "count"=>3, "sum"=>5.068565011024475}]}, {"name"=>"media_gallery_viewed", "tags"=>{"estimate_appointment_id"=>"10998817", "user_id"=>"38138"}, "values"=>[{"time"=>"2018-09-02T00:00:00Z", "count"=>1, "sum"=>3.566429018974304}]}, {"name"=>"media_gallery_viewed", "tags"=>{"estimate_appointment_id"=>"10998841", "user_id"=>"7731"}, "values"=>[{"time"=>"2018-09-02T00:00:00Z", "count"=>2, "sum"=>366.0380080938339}]}, {"name"=>"media_gallery_viewed", "tags"=>{"estimate_appointment_id"=>"10998844", "user_id"=>"37"}, "values"=>[{"time"=>"2018-09-02T00:00:00Z