Skip to content

Instantly share code, notes, and snippets.

View mariusz-blaszczak's full-sized avatar

Mariusz Błaszczak mariusz-blaszczak

View GitHub Profile
<receiver android:name=".widget.LockWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/appwidget_info"/>
</receiver>
module Slack
class MessageReceivedEventHandler
attr_reader :message
def initialize(message)
@message = message
end
def handle
if message_implicate_that_doors_were_just_opened?
Doors.open!
module Firebase
class PushToAndroid
SERVER_KEY = ENV.fetch('FIREBASE_APP_SERVER_KEY')
def call
registration_ids = User.all.map(&:registration_id)
options = { data: { state: Doors.last_event.attributes }, collapse_key: 'updated_score' }
fcm = FCM.new(SERVER_KEY)
fcm.send(registration_ids, options)
end
end
class DoorsStateController < ApplicationController
def toggle
event = Doors.toggle
render json: {
status: 'success',
body: event
}
end
def read
class Doors
def self.close!
DoorsEvent.create(state: DoorsEvent.states[:closed])
end
def self.open!
DoorsEvent.create(state: DoorsEvent.states[:open])
end
def self.toggle!
@mariusz-blaszczak
mariusz-blaszczak / transaction_spec.rb
Created January 24, 2018 08:29
Ruby code sample for rubymine support
# not expected
it 'updates postal code of the customer' do
customer = build(:hiltes_kunde)
customer.anschrift.Plz = '1500'
customer.save
params = ActionController::Parameters.new(
postal_code: '1501', hiltes_mandant: 1, hiltes_firmengruppe: 1, hiltes_nr: customer.Nr
)
service = described_class.new
➜ myshoppy git:(run-tests-before-deploy-on-master-capistrano) ✗ bundle exec cap production doctor
rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
ruby-2.4.1
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Environment
Ruby ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Rubygems 2.6.11
Bundler 1.16.0
require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require "capistrano/rvm"
require "capistrano/bundler"
require "capistrano/rails/migrations"
require "capistrano/linuxpl"
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
@mariusz-blaszczak
mariusz-blaszczak / kindlegen.log
Created July 23, 2017 04:57
Kindlegen output pipe while not generating images
*************************************************************
Amazon kindlegen(Linux) V2.9 build 1028-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014
*************************************************************
Info(prcgen):I1047: Added metadata dc:Title "test 4"
Info(prcgen):I1047: Added metadata dc:Creator "webook"
Info(prcgen):I1047: Added metadata dc:Publisher "webook"
Info(prcgen):I1002: Parsing files 0000002
ProblemType: Crash
Architecture: amd64
Date: Thu Jun 1 08:24:10 2017
DistroRelease: Ubuntu 17.04
ExecutablePath: /var/www/webook_disk/kindlegen
ExecutableTimestamp: 1496222745
ProcCmdline: ./kindlegen /var/www/webook_disk/books_drafts/1234/book.opf -o 1234.mobi
ProcCwd: /var/www/webook_disk
ProcEnviron:
LC_TIME=pl_PL.UTF-8