Skip to content

Instantly share code, notes, and snippets.

{
"data": {
"character_name": "egg",
"stage": "egg",
"speeches": [
{
"text": "おはようございます!",
"expressions": [
{
"start": 0,
@manhnhhdvn
manhnhhdvn / youtube_migrate.py
Last active June 28, 2020 04:50 — forked from skhzhang/youtube_migrate.py
Transfer YouTube subscriptions to another account
"""
Automatic migration of subscriptions to another
YouTube account with Python and Selenium.
Tested with:
- selenium 3.0
- firefox 49.0
- python 3.5
1. Install selenium from pypi:
@manhnhhdvn
manhnhhdvn / isOnlyOneEmoji.dart
Created December 12, 2019 09:02
isOnlyOneEmoji.dart
import 'dart:collection';
class EmojiService {
// 100%ではない。ほぼ一般な絵文字をmatchできる
// 使わない
// bool isOnlyOneEmoji_Old(String text) {
// RegExp regExp = RegExp(
// r"^(\uD83D(?:[\uDC76\uDC66\uDC67](?:\uD83C[\uDFFB-\uDFFF])?|\uDC68(?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u200D(?:\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92]|\u2708\uFE0F?|\uD83E[\uDDB0-\uDDB3]))?)|\u200D(?:\u2695\uFE0F?|\uD83C[\uDF93\uDFEB\uDF3E\uDF73\uDFED\uDFA4\uDFA8]|\u2696\uFE0F?|\uD83D(?:\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uDC68\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|[\uDD27\uDCBC\uDD2C\uDCBB\uDE80\uDE92])|\u2708\uFE0F?|\uD83E[\uDDB0-\uDDB3]|\u2764(?:\uFE0F\u200D\uD83D(?:\uDC8B\u200D\uD83D\uDC68|\uDC68)|\u200D\uD83D(?:\uDC8B\u200D\uD83D\uDC68|\uDC68)))))?|\uDC69(?:(?:\uD83C(?:[\uDFFB-\uDFFF](?:\u20
@manhnhhdvn
manhnhhdvn / backtrack.swift
Created July 23, 2019 06:06
Test backtrack
import Foundation
let dict: [[String]] = [["seagames", "đại hội thể thao đông nam á"],
["có bao nhiêu", "số lượng"],
["nước", "quốc gia"],
["tham dự", "tham gia", "có mặt", "thi đấu"]]
func printResult(mask: [Int]) {
print(mask)
var resultString = ""
Brew error on macOS High Sierra: Check you have permission to write to /usr/local
You just have to uninstall and reinstall Brew on your Mac:
```
brew bundle dump
```
And then:
@manhnhhdvn
manhnhhdvn / DynamicInitArrayFromJson.swift
Created October 2, 2018 09:06
Dynamic init array from json
import Foundation
protocol Initializable {
static func initWith(json: String) -> Any
}
class TestModel : Initializable {
var json : String
static func initWith(json: String) -> Any {
- 過去30日以内に: từ ngày hôm nay nhìn về trong vòng 30 ngày ở quá khứ
- 過去31日以前に: từ ngày hôm nay nhìn về ngày thứ 31 trở đi ở quá khứ
- 将来30日以内に: từ ngày hôm nay nhìn tới trong vòng 30 ngày ở tương lai
- 将来31日以降に: từ ngày hôm nay nhìn tới ngày thứ 31 trở đi ở tương lai
@manhnhhdvn
manhnhhdvn / 日本語の丁寧度
Created January 19, 2018 02:29
日本語の丁寧度
ルール:
         否定形 > 肯定形
      (~ませんか) (~ますか)
   相手に決定を委ねる > 自分が決める
    (~てくれますか) (~てください)
    はっきり言わない > はっきり言う
    (~たいんですが) (~ませんか)
@manhnhhdvn
manhnhhdvn / RecursionSubViews.swift
Last active October 23, 2017 03:56
Recursively find subviews in swift
extension UIView {
func getSpecifiedTypeInSubviews<T: UIView>() -> [T] {
var subviews = [T]()
self.subviews.forEach { subview in
subviews += subview.getSpecifiedTypeInSubviews() as [T]
if let subview = subview as? T {
subviews.append(subview)
}
}
return subviews
@manhnhhdvn
manhnhhdvn / EmojiSwift4.swift
Created September 29, 2017 08:33
Emoji in Swift 4, Xcode 9
extension String {
public var containsEmoji: Bool {
let invalid = self.filter { char in
if let code = String(char).utf16.first {
if 0xd800 <= code && code <= 0xdbff {
return true
}
}
return false