Skip to content

Instantly share code, notes, and snippets.

View vaughankg's full-sized avatar

Vaughan Kelly Guy vaughankg

View GitHub Profile
{
"serviceLocationId": 60021,
"sensorId": 1,
"records": [
{
"timestamp": 1615852800000
},
{
"timestamp": 1615853700000
},
@vaughankg
vaughankg / gist:313e8daa783a5283a78fea339a939e95
Last active March 16, 2021 19:33
Metering configuration
{
"lon": -0.6774620035007706,
"lat": 51.354644775390625,
"electricityCost": 0,
"electricityCurrency": "GBP",
"timezone": "Europe/London",
"appliances": [
{
"id": 2,
"name": "Cooker",
@vaughankg
vaughankg / gist:c15f39736948ef37646e2660700ea700
Created March 16, 2021 14:54
Electricity consumption interval
{
"timestamp": 1615849200000,
"consumption": 40.983,
"solar": 0,
"alwaysOn": 83.016,
"gridImport": 40.983,
"gridExport": 0,
"selfConsumption": 0,
"selfSufficiency": 0,
"active": [
{
"lon": -0.6774620035007706,
"lat": 51.354644775390625,
"electricityCost": 0,
"electricityCurrency": "GBP",
"timezone": "Europe/London",
"appliances": [
{
"id": 2,
"name": "Cooker",
@vaughankg
vaughankg / db.rake
Last active August 29, 2015 14:20 — forked from hopsoft/db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@vaughankg
vaughankg / gist:6453125
Created September 5, 2013 17:08
Center a div in the middle of the screen
.dead-center {
height: 200px;
width: 200px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 0 auto;
}
@vaughankg
vaughankg / _notices.html.erb
Created September 5, 2013 01:11
Bootstrap alerts in Rails. Stolen from https://coderwall.com/p/jzofog
<% flash.each do |key, value| %>
<div class="<%= flash_class(key) %>">
<%= value %>
</div>
<% end %>
class SessionsController < ApplicationController
def create
auth = request.env["omniauth.auth"]
@identity = Identity.find_with_omniauth(auth)
if @identity.nil?
@identity = Identity.create_with_omniauth(auth)
end
if signed_in?
Sub OnChangeCopyUnderScenario(ByVal Target As Range, trigger_area As String, from_area As String, to_area As String, scenario_cell As String, scenario_value As Integer)
'Usage: OnChangeCopyUnderScenario(Target, "drivers area", "input area", "output area", "scenario cell", "scenario value")
On Error GoTo ErrorHandler
'Dim
Dim trigger_range As Range
Set trigger_range = Range(trigger_area)
If Not Application.Intersect(trigger_range, Target) Is Nothing Then