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
# 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
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
tell application "Notes" | |
set theNotes to every note of the folder "Notes" | |
repeat with thisNote in theNotes | |
set myTitle to the name of thisNote | |
set myText to the body of thisNote | |
set myCreateDate to the creation date of thisNote | |
set myUpdateDate to the modification date of thisNote | |
tell application "Evernote" | |
set theTransferredNote to create note with html myText ¬ | |
title myTitle ¬ |
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
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: "richard@piedpiper.com" | |
# 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: "richard@piedpiper.com" |
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
<%= gmaps4rails(@json) %> | |
<% content_for :scripts do %> | |
<script type="text/javascript" charset="utf-8"> | |
var markersArray = []; | |
// On click, clear markers, place a new one, update coordinates in the form | |
Gmaps.map.callback = function() { | |
google.maps.event.addListener(Gmaps.map.map, 'click', function(event) { | |
clearOverlays(); | |
placeMarker(event.latLng); | |
updateFormLocation(event.latLng); |
NewerOlder