This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ScrollViewThatFits<Content: View>: View { | |
var showsIndicators: Bool | |
@ViewBuilder | |
var content: Content | |
init(showsIndicators: Bool = false, @ViewBuilder content: () -> Content) { | |
self.showsIndicators = showsIndicators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Don't forget to run 'chmod +x ci_post_xcodebuild.sh' from the terminal after adding this file to your project | |
set -e | |
if [[ -n $CI_ARCHIVE_PATH ]]; | |
then | |
# Install Sentry CLI into the current directory ($CI_PRIMARY_REPOSITORY_PATH/ci_scripts) | |
export INSTALL_DIR=$PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension UIFont { | |
static func fractionFont(ofSize pointSize: CGFloat) -> UIFont { | |
let systemFontDesc = UIFont.systemFont(ofSize: pointSize).fontDescriptor | |
let featureSettings: [UIFontDescriptor.FeatureKey: Int] = [ | |
.type: kFractionsType, | |
.selector: kDiagonalFractionsSelector, | |
] | |
let attributes = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SettingsSection: View { | |
@State var isShowingCloudLink = false | |
var body: some View { | |
Section { | |
if isShowingCloudLink { | |
NavigationLink(destination: CloudSettingsView()) { | |
Label(…) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct UIElementPreview<Value: View>: View { | |
enum Format { | |
case device, sizeThatFits, darkMode, rightToLeft, localizations, contentSizes, contentSizesMinMax | |
} | |
var formats: [Format] | |
/// Filter out "base" to prevent a duplicate preview. | |
private let localizations = Bundle.main.localizations.map(Locale.init).filter { $0.identifier != "base" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mailboxes/concerns/mail_params.rb | |
module MailParams | |
extend ActiveSupport::Concern | |
def mail_params | |
attachments = build_attachments | |
body = build_rich_body(attachments) | |
{ subject: mail.subject, body: body, attachments: attachments.map { |a| a[:blob] } } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def args_to_array(*args) | |
p args | |
end | |
args_to_array("hello", "world") | |
# ["hello", "world"] | |
def args_to_array(foo, *args) # Works, order matters | |
p "foo: #{foo}", args | |
end | |
args_to_array("hello", "world") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= f.label :email, required: true, class: "block text-xxs uppercase text-gray-500" do |label_builder| | |
= label_builder.translation | |
span.ml-2.normal-case.text-orange-400.text-xxs.font-semibold= t("required") | |
= f.email_field :email, autocomplete: false, required: true, class: "form-input mt-1 block w-full text-field focus:shadow-outline focus:border-green-300", placeholder: "[email protected]" | |
# Or with the form builder | |
= f.label :email, required: true, class: "block text-xxs uppercase text-gray-500", required_class: "ml-2 normal-case text-orange-400 text-xxs font-semibold" | |
= f.email_field :email, autocomplete: false, required: true, class: "form-input mt-1 block w-full text-field focus:shadow-outline focus:border-green-300", placeholder: "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormObjectBase | |
include ::ActiveModel::Validations | |
attr_reader :object, :params | |
def initialize(object) | |
@object = object | |
end | |
def assign(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my-icons-spacing: 10px; // give some space to avoid little pixel size issues on resize | |
@import "my-icons/*.png"; | |
$my-icons-sprite-dimensions: true; | |
@include all-my-icons-sprites; | |
// the fun part |
NewerOlder