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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>QR Code Clock</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/moment.min.js"></script> | |
<style> |
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
#!/usr/bin/env -S deno run --allow-net --allow-write | |
/** | |
* Zennのトップページまたは指定したタグのページを読み込み、Markdown形式でまとめて出力するスクリプト | |
* - オプションなしで実行すると"https://zenn.dev/articles/explore?tech_order=weekly"にアクセスし、 | |
* "yyyyMMddhhmm-trend.md" のファイル名でMarkdownファイルを生成する。 | |
* - `--tags タグ名`(タグはrustやtypescriptなど)で実行すると"https://zenn.dev/topics/タグ名"にアクセスし、 | |
* "yyyyMMddhhmm-{タグ名}.md" のファイル名でMarkdownファイルを生成する。 | |
* - `--stdout`オプションを付けて実行すると、ファイル出力せずに標準出力へMarkdownテキストを出力する | |
* | |
* 使用方法: |
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
// | |
// CustomSlider.swift | |
// | |
// @Refer: https://betterprogramming.pub/reusable-components-in-swiftui-custom-sliders-8c115914b856 | |
// @Usage: | |
// | |
// CustomSlider(value: $state.exposureValue, range: (0, 1)) { modifiers in | |
// ZStack { | |
// LinearGradient(gradient: .init(colors: [Color.pink, Color.orange ]), startPoint: .leading, endPoint: .trailing) | |
// ZStack { |
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 UIKit | |
extension UIImageView { | |
/// UIImageView上での座標が指す色をUIColorで返す。画像が未設定の場合はnilを返す | |
/// | |
/// 以下のように使う. | |
/// | |
/// @objc func tappedImage(_ sender: UITapGestureRecognizer) { | |
/// let point = sender.location(in: self) | |
/// let color = self.pixelColor(at: point) // <- here |
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
extension UIImageView { | |
/// UIImageView上での座標が指す色をUIColorで返す。画像が未設定の場合はnilを返す | |
/// | |
/// 以下のように使う. | |
/// | |
/// @objc func tappedImage(_ sender: UITapGestureRecognizer) { | |
/// let point = sender.location(in: self) | |
/// let color = self.pixelColor(at: point) // <- here | |
/// : | |
/// } |
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 to_euler_angles(R): | |
"""Calculate rotation matrix to euler angles. | |
The result is the same as MATLAB except the order | |
of the euler angles ( x and z are swapped ). | |
Args: | |
R (np.ndarray): rotation matrix. | |
""" |
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
/* | |
iPadは縦横どちらの向きでもUIUserInterfaceSizeClassが.regularなので、AutoLayoutのOrientationによる表示変更ができない。 | |
以下のコードを必要なViewControllerに書いておくと`.regular × .compact`と判断するようになりiPhoneと同じルールでレイアウトできる。 | |
*/ | |
// MARK: - Trick for iPad device orientation | |
override public var traitCollection: UITraitCollection { | |
let device = UIDevice.current | |
let result: UITraitCollection |
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
javascript:caption=window.getSelection()+'';if(caption==""){caption=document.title;}i=document.createElement('input');i.setAttribute('id','copyinput');document.body.appendChild(i);i.value='%5B'+caption+'%5D('+location.href+')';i.select();document.execCommand('copy');document.body.removeChild(i);void(0); | |
// execute the bookmarklet without selection: [page's title](page URL) | |
// execute it with selection: [selected string](page URL) |
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
set DEVICE_NAME to "ここにアプリが入ったデバイス名(My iPhoneとか)" | |
set APP_NAME to "ここにアプリ名" | |
tell application "System Events" | |
tell process "Xcode" | |
--- set frontmost to true | |
click menu item "Devices" of menu "Window" of menu bar 1 | |
tell window "Devices" | |
--- button 1-3はクローズ・最大化・最小化 | |
--- table 1 of scroll area 1 of splitter group 1は左ペイン内のがデバイスやシミュレータなど |
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
extension Array where Element == Float { | |
// @see: HOW TO CREATE A SOUNDCLOUD LIKE WAVEFORM IN SWIFT 3 | |
// (https://miguelsaldana.me/2017/03/13/how-to-create-a-soundcloud-like-waveform-in-swift-3/) | |
func downSampled(binSize: Int, multiplier: Float = 1.0) -> [Float] { | |
let count = self.count | |
var processingBuffer = [Float](repeating: 0.0, | |
count: Int(count)) | |
let sampleCount = vDSP_Length(count) |
NewerOlder