This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public class CurveHitTester { | |
typealias CurvePointMapper = (t: CGFloat, u: CGFloat) -> (x: CGFloat, y: CGFloat) | |
public static func hitTestLine(point: CGPoint, p1: CGPoint, p2: CGPoint, segments: Int, lineWidth: CGFloat) -> Bool { | |
return hitTestPoints(point, segments: segments, lineWidth: lineWidth) { (t, u) in | |
let x = u * p1.x + t * p2.x | |
let y = u * p1.y + t * p2.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PaperSwift | |
let ExampleScript1 = { (paper: PaperView) in | |
var center: CGPoint | |
var width: CGFloat | |
var height: CGFloat | |
var pathHeight: CGFloat | |
let points = 8 | |
let path = paper.Path() | |
path.fillColor = UIColor.darkGrayColor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum Zundoko: CustomStringConvertible { | |
case Start | |
indirect case Zun(Zundoko) | |
indirect case Doko(Zundoko) | |
indirect case Kiyoshi(Zundoko) | |
var description: String { | |
switch self { | |
case Start: return "スタート!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author kakajika | |
* @since 2016/04/27 | |
*/ | |
public class MaxLinearLayout extends LinearLayout { | |
public MaxLinearLayout(Context context) { | |
super(context); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mov2gif() { | |
command ffmpeg -i $1 -vf "scale=320:-1" -pix_fmt rgb24 -r 30 -f gif - | gifsicle --delay=3 --optimize=3 > $2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Color; | |
import android.support.annotation.ColorInt; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Size; | |
public class ColorUtil { | |
public static @ColorInt int lighten(@ColorInt int color, float value) { | |
float[] hsl = colorToHSL(color); | |
hsl[2] += value / 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ikku.coffee | |
# | |
# Description: | |
# Bot for detecting ikku pattern. | |
# | |
{tokenize} = require 'kuromojin' | |
{nfkc} = require 'unorm' | |
haiku_pattern = [5, 7, 5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kuromoji.coffee | |
# | |
# Description: | |
# Bot for detecting ikku pattern. | |
# | |
{tokenize} = require 'kuromojin' | |
{nfkc} = require 'unorm' | |
listit = require 'list-it' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.firebase.database.* | |
import rx.Observable | |
import rx.lang.kotlin.add | |
import rx.lang.kotlin.observable | |
/** | |
* @author kakajika | |
* @since 2016/11/08 | |
*/ | |
class RxFirebaseDatabase { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function RxAutoDispose<T extends React.ComponentClass<any>>(target: T): T { | |
target.prototype.disposer = new Rx.Subscription() | |
const originalMount = target.prototype.componentDidMount | |
Object.defineProperty(target.prototype, "componentDidMount", { | |
value: function() { | |
console.log("componentDidMount") | |
return originalMount.apply(this, arguments) | |
} | |
}) |