Skip to content

Instantly share code, notes, and snippets.

View svyatogor's full-sized avatar

Sergey Kuleshov svyatogor

View GitHub Profile
@svyatogor
svyatogor / broadlink_to_tuya.py
Last active March 12, 2024 22:16
Convert SmartIR Broadlink commands to Tuya
@svyatogor
svyatogor / RxJS-vs-Nanostore.ts
Last active June 8, 2023 06:43
RxJS-vs-Nanotore.ts
// RxJS
const address$ = new BehaviourSubject<string>(undefined);
const signature$ = address$.pipe(
filter((address): address is string => !!address),
switchMap(async (address) => {
return await signWelcomeToken(address);
}),
catchError((err) => of(undefined)),
tap(store('signature'))
@svyatogor
svyatogor / LibBoostAsioHandler.hpp
Last active January 31, 2022 01:17
AMQP-CPP Boost Asio handler
#pragma once
#include <amqpcpp/linux_tcp.h>
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/posix/stream_descriptor.hpp>
#include <boost/foreach.hpp>
using namespace std;
Product Manager Assessment
The Marketing team asked the Product team to define the Direct Notifications service for our self-developed CRM. They would like to notify clients about the new opportunities, promotions, product updates, etc.
Marketing specialist will be manually setting up these notifications, adding:
notification caption and text;
segment of the users to be affected (filtered by country of residence, regulator, time since account was created);
link to follow;
app to show the notification in (we have several client applications - explore to find out which ones).
#!/bin/sh
yaml2json() {
ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' $*
}
PAPERTRAIL_TOKEN=$(cat ~/.papertrail.yml | yaml2json | jq -r .token)
FROM=$(date -j -u -f "%Y-%m-%d" "$1" +%s)
TO=$(date -j -u -f "%Y-%m-%d" $2 +%s)
curl -sH "X-Papertrail-Token: $PAPERTRAIL_TOKEN" https://papertrailapp.com/api/v1/archives.json |
@startuml
skinparam backgroundColor fff
!define PRIMARY fff
!define ACCENT 1a66c2
!define ACCENTDARK 124787
!define ACCENTLITE 2a86e2
!define FONTNAME "Helvetica"
!define FONTSIZE 13
skinparam {
@svyatogor
svyatogor / app_delegate.rb
Created August 23, 2015 16:10
Crash in Xcode 7b5 on corefoundation object autorelease
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
rootViewController = UIViewController.alloc.init
rootViewController.title = 'cftest'
rootViewController.view.backgroundColor = UIColor.whiteColor
navigationController = UINavigationController.alloc.initWithRootViewController(rootViewController)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = navigationController
@svyatogor
svyatogor / gist:89c9ccbbe3f33cb599bf
Created April 22, 2015 22:08
upload dSYM to bugsnag after archive:distribution task in your rubymotion project
task "upload_dsym" do
dsym_path = App.config.app_bundle_dsym(App.config.deploy_platform)
app_name = App.config_without_setup.name
`curl https://upload.bugsnag.com/ -F dsym=@"#{dsym_path}/Contents/Resources/DWARF/#{app_name}"`
end
namespace :archive do
task :distribution do
Rake::Task['upload_dsym'].invoke
end
class MessageCheckMark < UIView
attr_accessor :selected, :padding
def initWithFrame(frame)
if super
self.backgroundColor = UIColor.clearColor
self.padding = 8
end
self
end
class A
attr_accessor :id
def initialize(_id)
self.id = _id
end
def hash
@id.hash
end