Skip to content

Instantly share code, notes, and snippets.

@ka2n
ka2n / main.go
Last active October 18, 2023 16:14
Parse yaml with dynamic key name usign go.
package main
import (
"io/ioutil"
"log"
"gopkg.in/yaml.v2"
)
type Config struct {
@ka2n
ka2n / String+chunkByLength.swift
Created January 12, 2017 22:32
Split String into [String] in specified characters length. swift3
public extension String {
public func chunkByLength(_ count: UInt) -> [String] {
var result = [String]()
var idx = characters.startIndex
while idx < characters.endIndex {
let next = characters.index(idx, offsetBy: Int(count), limitedBy: characters.endIndex) ?? characters.endIndex
if idx == next {
break
}
result.append(self[idx..<next])

Keybase proof

I hereby claim:

  • I am ka2n on github.
  • I am ka2n (https://keybase.io/ka2n) on keybase.
  • I have a public key ASA7tKkMG1owTq0T0rWKOZtsoWegDOXfSO3nmLsh4m4RBgo

To claim this, I am signing this object:

import React from 'react'
import { PropTypes } from 'react'
import { throttle } from 'lodash'
export default class InfiniteList extends React.Component {
static propTypes = {
initialElements: PropTypes.arrayOf(PropTypes.node),
endElement: PropTypes.node,
moreElement: PropTypes.node,
@ka2n
ka2n / minimum_configure
Created August 25, 2015 09:11
Minimum configuration file for artoolkit5.3
#!/bin/sh
MDIR=". \
lib/SRC \
lib/SRC/AR \
lib/SRC/AR/arLabelingSub \
lib/SRC/ARICP \
lib/SRC/AR2 \
lib/SRC/KPM \
lib/SRC/Util \
@ka2n
ka2n / gist:ae2c0c6f596474504889
Created October 6, 2014 10:21
cocoapodで自家製.podspecを作るときの注意点
`___MAXOSX`, `.DS_Store`がzipファイル中に入っていると
`ERROR | [iOS] The `source_files` pattern did not match any file.`
`ERROR | [iOS] The `preserve_paths` pattern did not match any file.`
とか怒られるので注意
# coding: utf-8
# Fetch remember the milk API info
require 'pp'
require 'nokogiri'
require 'open-uri'
require 'erb'
require 'active_support/dependencies'
class String
@ka2n
ka2n / toggle.js
Last active August 29, 2015 14:02
Sqwiggle minimum mode
/*
# Save this file to /Applications/Sqwiggle.app/Contents/Resources/app.nw/assets/js/toggle.js
# And Add
<script src="assets/js/toggle.js" type="text/javascript"></script>
to /Applications/Sqwiggle.app/Contents/Resources/app.nw/index.html
*/
---
BUNDLE_BUILD__NOKOGIRI: "--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28/ --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib"
@ka2n
ka2n / test.m
Created February 5, 2014 06:08
いろいろテストが面倒なときによくやるSnippet
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[NSObject cancelPreviousPerformRequestsWithTarget:[SomeClass sharedInstance]];
[[SomeClass sharedInstance] performSelector:@selector(someMethod:) withObject:someObject afterDelay:5.0];
}