Skip to content

Instantly share code, notes, and snippets.

template:
- sensor:
- name: "Solarman PV Power"
unit_of_measurement: "W"
state: >
{{ states('sensor.solarman_pv1_power') | float + states('sensor.solarman_pv2_power') | float }}
- name: "Solarman Battery discharge"
unit_of_measurement: "W"
@ondrejbartas
ondrejbartas / how_to_setup_cypress_with_rails_app.md
Last active April 2, 2021 01:15
How to setup Cypress on Rails apps

How to setup Cypress on Rails apps

You need to update circle.yml:

machine:
  node: # add node dependency
    version:
      7.4

environment:

React is the new Lego - how we deal with a lot of components

Lightning talk proposal for ReactiveConf 2016

BlueKit usage

At Blueberry, we've been frustrated with maintaining and getting oriented in our React components and their props. That's why we made a tool for automatically generating a component library from a project's components.

We named it BlueKit and released it as open-source.

@ondrejbartas
ondrejbartas / .profile
Created August 16, 2016 09:43 — forked from sindresorhus/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
require 'json'
package = JSON.parse(File.open('./package.json').read)
mainfiles = Dir['./node_modules/*'].map{|f| "#{f}/package.json"}.select{|f| File.exist?(f)}.map{|f| JSON.parse(File.open(f).read)}
organizationfiles = Dir[*Dir['./node_modules/*'].select{|f| !File.exist?("#{f}/package.json")}.map{|x| "#{x}/*"}].map{|f| "#{f}/package.json"}.select{|f| File.exist?(f)}.map{|f| JSON.parse(File.open(f).read)}
files = mainfiles | organizationfiles
out = {
'devDependencies' => {},
'dependencies' => {}
############
# PLASE FILL
############
secret_key = "APPLICATION_SECRET_KEY_INSERT"
application = "APPLICATION_KEY_INSERT"
instance = "INSTANCE_INSERT"
############
# THAN RUM
# -*- encoding : utf-8 -*-
require 'tire'
require 'tire/http/clients/curb'
Tire.configure do
# # logger 'log/elasticsearch.log', :level => 'debug' if Bandit.env == 'development'
# #logger STDOUT, :level => 'debug'
client Tire::HTTP::Client::Curb
end
@ondrejbartas
ondrejbartas / _ios_icons.html.erb
Created May 31, 2013 10:40
apple-icon-setup.html
<!-- iPad Settings -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- iOS ICONS -->
<link rel="apple-touch-icon" sizes="144x144" href="<%= image_path("apple_icons/icon-144.png") -%>" />
<link rel="apple-touch-icon" sizes="114x114" href="<%= image_path("apple_icons/icon-114.png") -%>" />
<link rel="apple-touch-icon" sizes="72x72" href="<%= image_path("apple_icons/icon-72.png") -%>" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%= image_path("apple_icons/icon-144.png") -%>" />
def show_nfi_tfl percent
if percent.nil?
""
elsif percent < 0
tfl = "tfl_3critical"
elsif percent < 10
tfl = "tfl_3red"
elsif percent < 20
tfl = "tfl_2yellow"
@ondrejbartas
ondrejbartas / gist:3526110
Created August 30, 2012 10:45
Make sessions work in Rack::Test with Sinatra's sessions
# Put this in your test helper file
# This works when using the default Sinatra sessions (i.e. enable :sessions)
# (helper preamble not included)
require 'securerandom'
class Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application # or the name of your modular app