Skip to content

Instantly share code, notes, and snippets.

View kboy-silvergym's full-sized avatar
🎯
Focusing

Kei Fujikawa kboy-silvergym

🎯
Focusing
View GitHub Profile
@kboy-silvergym
kboy-silvergym / slack_invite_bot.js
Last active October 29, 2021 09:11
timesという名前がつくチャンネルに招待してくれるslack botのGAS
var legacyToken = "xoxb-xxx";
var botUserId = "D020MGLFK0A";
var targetChannelPatterns = ['times_.*'];
// WebHook用 Hook発言をしたユーザー情報を取得し、全てのchannelにinviteしてあげる
function doPost(e){
var text = e.parameter.text.substring(e.parameter.trigger_word.length).trim();
if(text != "招待して"){
return postMessage(e.parameter.channel_id, "ちょっとよくわからないです");
@kboy-silvergym
kboy-silvergym / tinder_swipe_shotcut.js
Created September 27, 2019 15:37
Tinder swipe shortcut in iOS
const clickLikeButton = () => {
const buttons = document.getElementsByClassName("recsGamepad__button");
if (buttons) {
const likeButton = buttons[3];
likeButton.click();
} else {
alert("no buttons");
}
};
setInterval(
function () {
const elem = document.getElementsByClassName("recsGamepad__button");
elem[3].click();
}, 1000)
import Hydra
// このようなダイアログが出るメソッドがあるとします。
func showOKDialog(completion: (() -> Void)? = nil){
let alert: UIAlertController = UIAlertController(title: "hoge", message: nil, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: ok, style: .default, handler: { _ in
completion?()
})
alert.addAction(defaultAction)
present(alert, animated: true, completion: nil)
@kboy-silvergym
kboy-silvergym / ReplayKitSample.swift
Last active February 25, 2019 07:32
Sample code for ReplayKit
import ReplayKit
func startRecording() {
let recorder = RPScreenRecorder.shared()
recorder.isMicrophoneEnabled = true
recorder.startRecording(handler: { error in
if let error = error {
NSLog("Failed start recording: \(error.localizedDescription)")
return
}
@kboy-silvergym
kboy-silvergym / SnapLikePageViewController.swift
Last active November 14, 2019 15:18
Snapchat like PageViewController which is changing its alpha of background color as scrolling.
import UIKit
enum TutorialNumber {
case first
case second
}
protocol TutorialVC: class {
var number: TutorialNumber { get set }
}
@kboy-silvergym
kboy-silvergym / VideoUtils.swift
Created September 13, 2018 07:22
save video with muting and attaching logo images.
import AVFoundation
import Hydra
import Photos
struct VideoUtils {
// 動画の保存名
private static let logoVideoName = "logo.mp4"
private static let muteVideoName = "mute.mp4"
// 加工タイプ
@kboy-silvergym
kboy-silvergym / FadeInOutPlaneNode.swift
Last active September 13, 2018 01:29
FadeInOutPlaneNode
private let device = MTLCreateSystemDefaultDevice()!
private var fadingNode: SCNNode?
extension ViewController: ARSCNViewDelegate {
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
guard let planeAnchor = anchor as? ARPlaneAnchor else {
return
}
@kboy-silvergym
kboy-silvergym / MicroInteractUIButton.md
Last active May 25, 2020 18:39
Micro Interact UIButton

This UIButton changes own size like Snapchat buttons.

It will turn bigger during forcusing, and will turn default size when you release.

gif -8beb70b6fec0-1 gif -f5cc3a238cb3-1
@kboy-silvergym
kboy-silvergym / EasyDI.swift
Last active December 22, 2017 08:45
Easy Dependency Injection for Swift
protocol Repository {
func fetchInt() -> Int
}
class RepositoryImpl: Repository {
func fetchInt() -> Int {
// 通信する
let api = API()