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 / 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
@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 / 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
add = fn a, b -> a + b end
is_function add, 1 # false
add.(1, 2) # 3
@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 {
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
for i in [0..n-1]
for j in [i+1..n-1]
@takuoka
takuoka / file0.txt
Created June 21, 2013 19:28
[CoffeeScript] Facebookのcreated_timeからDateオブジェクトを返す関数 ref: http://qiita.com/entotsu@github/items/bbf1ee3cbef998b25f2f
newDate_from_facebook_created_time = (created_time)->
return new Date((created_time or "").replace(/-/g, "/").replace(/[TZ]/g, " "))
@takuoka
takuoka / file0.txt
Created June 21, 2013 16:18
[CoffeeScript]TwitterAPIのcreated_atからDateオブジェクトを返す関数 ref: http://qiita.com/entotsu@github/items/2fabf9a34d1e0bff620b
newDate_from_tweetCreatedAt = (created_at)->
created_at = created_at.split ' '
# 投稿日時変換 "Mon Dec 01 14:24:26 +0000 2008" -> "Dec 01, 2008 14:24:26"
post_date = created_at[1] + " " + created_at[2] + ", " + created_at[5] + " " + created_at[3]
# 日時データ処理
date = new Date post_date # 日付文字列 -> オブジェクト変換
date.setHours(date.getHours() + 9) # UTC -> JST (+9時間)
return date
@takuoka
takuoka / file0.txt
Created June 19, 2013 07:56
JavaScriptで確実にCSSを取得する ref: http://qiita.com/entotsu@github/items/c613781c11cebdde63c7
var style = element.currentStyle || document.defaultView.getComputedStyle(element, '')