Skip to content

Instantly share code, notes, and snippets.

View laprasdrum's full-sized avatar
🥁
(drumroll)

laprasdrum laprasdrum

🥁
(drumroll)
View GitHub Profile
@laprasdrum
laprasdrum / someAndAnyOnSwift5_7.swift
Created June 13, 2022 09:32
some and any keywords for generic protocols in Swift 5.7
/*
some and any keywords for generic protocols in Swift 5.7
https://swiftbysundell.com/articles/referencing-generic-protocols-with-some-and-any-keywords/
*/
protocol Item { }
struct User {
let name: String
var isAnonymous: Bool {
return name.isEmpty
@laprasdrum
laprasdrum / sendDirectMessage.gs
Created April 29, 2021 01:51
send direct messages (including group DMs) from GAS
const token = 'xoxb-xxx'
function main() {
var message = 'Hi :)'
// send direct message
var userID = 'UX...'
sendMessage(userID, message)
// send group direct message
@laprasdrum
laprasdrum / fetchZenHubIssues.js
Created March 16, 2021 06:50
Zapier Code: fetch pipeline issues from ZenHub & fill each issues' description from GitHub API
// generate pipeline issue message for Slack
// e.g. (all issue messages are linked)
//
// 📝 *TODO*
// prepare for dinner
// write blog
//
// 📝 *In Review*
// buy a new desk
@laprasdrum
laprasdrum / screenshot for smartphone
Created November 2, 2020 01:24
ScreenShot for smartphone with timestamp name
# iOS
# use libmobiledevice
# https://github.com/libimobiledevice/libimobiledevice
# https://formulae.brew.sh/formula/libimobiledevice
# save as 'ios_20200401_11.09.21.png'
$ date +%Y%m%d_%H.%M.%S | xargs -I{} sh -c 'idevicescreenshot /path/to/screenshot/ios_{}.png'
# Android
@laprasdrum
laprasdrum / iOSJailbreak.md
Last active November 25, 2023 20:25
iOS jailbreak -> layout check via cyrun
@laprasdrum
laprasdrum / TextFieldShakenErrorViewController.swift
Last active March 28, 2018 09:13
UITextField with shake error
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var textField: UITextField!
@IBOutlet weak var label: UILabel!
enum Placeholder {
case normal, empty
@laprasdrum
laprasdrum / cVimrc
Last active November 1, 2023 23:29
"Settings
let scrolltep = 60
let fullpagescrollpercent = 100
"set nohud
set autohidecursor
"set noinsertmappings
set nosmoothscroll
let blacklists = ["https://app.gather.town/*", "https://editor.note.com/*", "https://www.notion.so/*", "https://drive.mindmup.com/*", "https://app.clubhouse.io/*", "https://app.clickup.com/*", "https://app.classdo.com/*", "https://*.typeform.com/*", "https://magic-pod.com/*", "https://miro.com/app/*", "https://web.omnifocus.com/*", "https://developer.apple.com/*", "https://*.youtube.com/*", "https://*.1password.com", "https://*.slack.com/*", "https://kanbanflow.com/*", "https://trello.com/*", "https://workflowy.com/*", "https://app.zeplin.io/*", "https://*.google.com/*", "https://*classdo.*/*"]
let mapleader = ","
"let locale = "jp"
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
seperate := strings.Split(s, " ")
result := make(map[string]int)
package main
import (
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
var z complex128 = 1.0
for {
@laprasdrum
laprasdrum / SpongyCastleSample.java
Created April 19, 2014 10:53
convert X.509 certificate into PEM-formatted file with SpongyCastle
static {
Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);