Skip to content

Instantly share code, notes, and snippets.

View takuoka's full-sized avatar
Let's Rock

Takuya Okamoto takuoka

Let's Rock
View GitHub Profile
@takuoka
takuoka / gist:5c3e38178f9ad38384660d7ad5d6ab80
Created April 18, 2022 13:25
AppleScriptで時刻を確認して特定のURLを開く
set d to the weekday of the (current date)
set h to the hours of the (current date)
if d is not in {Sunday, Saturday} then
if (8 < h and h < 12) or (18 < h and h < 21) then
tell application "Google Chrome"
open location "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
end tell
end if
end if
@takuoka
takuoka / UIView+border.swift
Created January 10, 2018 09:04
Add border line view to UIView by AutoLayout or FrameLayout
//
// UIView+border.swift
// Makuake
//
// Created by Takuya Okamoto on 1/9/18.
// Copyright © 2018 CyberAgent Crowd Funding, Inc. All rights reserved.
//
import UIKit
extension UIView {
@takuoka
takuoka / AutoGrowingTextField.swift
Last active January 18, 2022 13:02
Example of an NSTextField that expands its height automatically. https://github.com/DouglasHeriot/AutoGrowingNSTextField
import Cocoa
// https://github.com/DouglasHeriot/AutoGrowingNSTextField
// for AutoLayout
class AutoGrowingTextField: NSTextField {
var minHeight: CGFloat? = 100
@takuoka
takuoka / file0.swift
Last active December 16, 2015 09:34
[iOS8~]セルの高さ可変UITableView(コードベース) ref: http://qiita.com/taku_oka/items/c3f9281c4a0c56218c2e
tableView.estimatedRowHeight = 464//だいたいの高さの見積もり?
tableView.rowHeight = UITableViewAutomaticDimension
import UIKit
import CollectionViewWaterfallLayout
class WaterfallCollectionViewController: UIViewController, UICollectionViewDataSource, CollectionViewWaterfallLayoutDelegate {
var collectionView: UICollectionView!
init () {
@takuoka
takuoka / SKTimingFunction.swift
Last active May 28, 2023 03:33
This is the TimingFunction class like CAMediaTimingFunction available in AnyWhere also SpriteKit. All the cool animation curves from `CAMediaTimingFunction` but it is limited to use with CoreAnimation. See what you can do with cubic Bezier curves here: http://cubic-bezier.com
//
// SKTimingFunction.swift
// Pods
//
// Created by Takuya Okamoto on 2015/10/06.
//
//
// inspired by https://gist.github.com/raphaelschaad/6739676
defmacro __using__(_opts) do
quote do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query, only: [from: 2]
import Ecto.Model
use Ecto.Model.OptimisticLock
use Ecto.Model.Timestamps
use Ecto.Model.Dependent
@takuoka
takuoka / file0.txt
Last active August 29, 2015 14:26
Elixirのデータ構造的なやつまとめ ref: http://qiita.com/taku_oka/items/083aa97f17a7e552d74b
iex> [a: a] = [a: 1]
[a: 1]
iex> a
1
iex> [a: a] = [a: 1, b: 2]
** (MatchError) no match of right hand side value: [a: 1, b: 2]
iex> [b: b, a: a] = [a: 1, b: 2]
** (MatchError) no match of right hand side value: [a: 1, b: 2]
add = fn a, b -> a + b end
is_function add, 1 # false
add.(1, 2) # 3
@takuoka
takuoka / file0.txt
Last active August 29, 2015 14:24
[CocoaPods]実機起動時の「Symbol not found」エラーでクソ詰まった ref: http://qiita.com/taku_oka/items/9162e02d51bd73bbcdad
dyld: Symbol not found: __TWPCSo7NSError13BrightFutures9ErrorTypeS0_
Referenced from: /private/var/mobile/Containers/Bundle/Application/E5242F00-6D45-4101-964C-6D42B2CDDA87/APlayerViewController.app/APlayerViewController
Expected in: /private/var/mobile/Containers/Bundle/Application/E5242F00-6D45-4101-964C-6D42B2CDDA87/APlayerViewController.app/Frameworks/BrightFutures.framework/BrightFutures
in /private/var/mobile/Containers/Bundle/Application/E5242F00-6D45-4101-964C-6D42B2CDDA87/APlayerViewController.app/APlayerViewController
(lldb)