Skip to content

Instantly share code, notes, and snippets.

@aganov
aganov / datetime_ui_input.rb
Created October 4, 2011 13:48
Formtastic jQuery UI date and time picker input
# http://jqueryui.com/demos/datepicker/
# http://fgelinas.com/code/timepicker/
class DatetimeUiInput
include Formtastic::Inputs::Base
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M"
def to_html
# rails generate migration change_to_utf8mb_encoding
class ChangeToUtf8mbEncoding < ActiveRecord::Migration
# def execute(text)
# puts text
# end
def db
ActiveRecord::Base.connection
end
@aganov
aganov / completeness.rb
Created March 25, 2016 06:56
rails-completeness
module Completeness
extend ActiveSupport::Concern
included do
class_attribute :completeness_checks
class_attribute :completeness_attributes
attr_accessor :completeness_points
attr_accessor :incomplete_attributes
end
@aganov
aganov / how-to.md
Last active May 27, 2016 19:54
fix-mkv
mkvmerge -i input.mkv
kvmerge --compression 0:none --compression 1:none --compression 2:none --clusters-in-meta-seek -o output.mkv input.mkv
@aganov
aganov / macos-station.md
Last active April 12, 2018 08:19
Bootstrap

Install minio

brew install minio
vim /usr/local/etc/minio/config.json
{
 "version": "20",
@aganov
aganov / authenticates_with_two_factor.rb
Created March 19, 2019 16:26
devise two-factor two steps
# frozen_string_literal: true
# Controller concern to handle two-factor authentication
# Upon inclusion, skips `require_no_authentication` on `:create`.
module AuthenticatesWithTwoFactor
extend ActiveSupport::Concern
included do
# This action comes from DeviseController, but because we call `sign_in`
# manually, not skipping this action would cause a "You are already signed
@aganov
aganov / application_form.rb
Last active October 18, 2019 11:51
poor man's reform
class ApplicationForm
include ActiveAttr::Model
attr_reader :model
delegate :new_record?, :persisted?, :model_name, :id, to: :model
class << self
# Don't sync virtual attributes to model
# ex: attribute :accept_tos, virtual: true
@aganov
aganov / @stripe+stripe-react-native+0.1.2.patch
Last active June 4, 2021 08:11
stripe-react-native CardField focus blur clear
diff --git a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt
index f13b188..37568f9 100644
--- a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt
+++ b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt
@@ -51,6 +51,27 @@ class StripeSdkCardView(private val context: ThemedReactContext) : FrameLayout(c
}
}
+ fun requestFocusFromJS() {
+ val binding = CardInputWidgetBinding.bind(mCardWidget)
@aganov
aganov / marlin.patch
Last active January 4, 2024 13:02
Ender 3 Marlin Config (SKR 1.3, CR-Touch)
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 9acdc107ca..2a53d61ff9 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -61,14 +61,14 @@
// @section info
// Author info of this build printed to the host during boot and M115
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
+#define STRING_CONFIG_H_AUTHOR "(Alex)" // Who made the changes.