Skip to content

Instantly share code, notes, and snippets.

View timurvafin's full-sized avatar

Timur Vafin timurvafin

View GitHub Profile
# blueprints/automation/timurvafin/tion.yaml
blueprint:
name: Tion Climate Control
description: Controls a Tion climate device based on fan speed, HVAC mode, and temperature sensors.
domain: automation
input:
climate_device:
name: Climate Device
### Zont Termostat ###
rest:
- resource: https://lk.zont-online.ru/api/widget/v2/get_devices
method: POST
authentication: basic
username: !secret zont_username
password: !secret zont_password
# app/assets/javascripts/exclude_options.coffee
class @ExcludeOptions
constructor: (el) ->
$el = $(el)
trigger_id = "#" + $el.data("exclude-options")
@$trigger = $el.find(trigger_id)
@$options = $el.find("input[type=checkbox]").not(trigger_id)
@_bindEvents()
# app/assets/javascripts/toggleable_container.coffee
class @ToggleableContainer
constructor: (el) ->
@$el = $(el)
@$container = $("#" + @$el.data("toggleable"))
@_bindEvents()
_bindEvents: ->
@$el.on "change", @_toogle
class CustomComponent
constructor: (@$el) ->
@dataKey = "custom-key"
@defaults = {}
@options = @_options(@$el)
_bindEvents: ->
@$el.on "click", ...
_options: ($el) ->
@timurvafin
timurvafin / upgrade.md
Last active October 5, 2015 10:41
Upgrade to osx 10.11

Upgrade from 10.10 to 10.11

You will require ~ 1h to setup all things.

Homebrew

brew update

OSX

class ApplicationController < ActionController::Base
include Authentication
include Authorization
protect_from_forgery
responders :flash
decent_configuration do
strategy DecentExposure::StrongParametersStrategy
end
class CollectionPresenter
include Enumerable
delegate :current_page, :total_pages, :limit_value, :entry_name, :total_count,
:offset_value, :last_page?, to: :@collection
cattr_accessor :presenter
self.presenter = ModelPresenter
def initialize(collection)
@timurvafin
timurvafin / Gemfile
Created April 3, 2015 10:15
Ruby base with Standalone Migrations
source "https://rubygems.org"
ruby "2.2.1"
gem "sqlite3"
gem "activerecord"
gem "standalone_migrations"
group :development do
gem "rubocop"
@timurvafin
timurvafin / README.md
Last active August 29, 2015 14:10
VPN for Github
  1. Sign up https://www.frootvpn.com
  2. Download scripts
wget https://www.frootvpn.com/files/frootvpn.ovpn -O /etc/openvpn/frootvpn.ovpn
wget https://gist.githubusercontent.com/timurvafin/c0e953302cb9fce44f73/raw/74a45a61f3721d32d07b6119f815ed22df6dfdf0/github.sh -O /etc/openvpn/start_github.sh
wget https://gist.githubusercontent.com/timurvafin/c0e953302cb9fce44f73/raw/89a71b3d8f7f52bf3a7a23c72910c898d1b812a3/stop_github.sh -O /etc/openvpn/stop_github.sh