Skip to content

Instantly share code, notes, and snippets.

@seka
seka / Sample.swift
Created April 27, 2020 06:29
NSDataとCFDataの関係をメモ (Toll-Free Bridge)
import Foundation
var data: NSData = NSData.init(bytes: "Hello, World!", length: 13)
withUnsafePointer(to: data) {
print("value \(String(describing: data)) has address: \($0)")
}
var cfData: CFData = data
withUnsafePointer(to: cfData) {
@seka
seka / HTMLConverter.kt
Created October 21, 2018 16:59
HTML から Android のコンポーネントを作成してみるサンプル
package jp.example.android.util.html
import android.content.Context
import android.graphics.Bitmap
import android.support.v4.content.ContextCompat
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned.SPAN_INCLUSIVE_INCLUSIVE
import android.text.style.TextAppearanceSpan
import android.view.Gravity.CENTER
@seka
seka / gist:bf0a7ec699aaf0fa2368590f11044aad
Last active October 25, 2016 04:47
リクエストのサンプル
{
"lunch_id": int,
"separateSize": int,
"members": [
{
"user_id": int,
"user_name": string,
"user_sex": boolean
"user_expense_times": int
"user_select_shop_times": int
{
"sort-order": [
"align-content",
"align-items",
"align-self",
"-o-animation",
"-ms-animation",
"-moz-animation",
"-webkit-animation",
"animation",
@seka
seka / gist:c5894488d7e07d583630
Created January 31, 2016 11:50
postcss-style-guide のテストに使ったファイル
var gulp = require('gulp');
var fs = require('fs');
var postcss = require('gulp-postcss');
var scss = require('postcss-scss');
var styleguide = require('postcss-style-guide');
gulp.task('default', function () {
var processors = [
styleguide
@seka
seka / setup-nginx.sh
Created November 12, 2015 12:48
setup script of nginx.
# Install
sudo touch /etc/yum.repos.d/nginx.repo
sudo sh -c "cat << 'EOF' > /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
EOF"
sudo yum update -y
@seka
seka / sample-cluster.conf
Created September 30, 2015 15:48
gnatsdのclusterについて, confファイルの設定方法をメモ
# クライアントからは以下のようにして接続
# nats://user:password@localhost:4242
port: 4242
authorization {
user: user
password: password
}
# クラスタの設定
cluster {
@seka
seka / sample.html
Created August 27, 2015 01:55
An invalid form control with name='' is not focusable.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>sample html</title>
</head>
<body>
<form id="hoge">
<fieldset>
<legend>test form</legend>
@seka
seka / Ownd.coffee
Created April 18, 2015 12:43
Ameba Owndのある記事からデータを抜き出すために作ったスクリプト
https = require 'https'
async = require 'async'
global = {
url: 'https://api.amebaowndme.com/v2/public/blogPosts?limit=200&page=&siteId=11014&sortType=recent'
}
requestURL = (callback) =>
req = https.get global.url, (res) ->
@res = ""
@seka
seka / mongoose-group
Last active August 29, 2015 14:16
node.jsでmongooseを使っている際、純粋なgroup メソッドを利用する。
var mongoose = require("mongoose");
var DBName = "";
M.prototype.connection = mongoose.createConnection("mongodb://127.0.0.1/" + DBName, callback);
var database = M.connection.db
var collection = database.collection("datas");
// keys (object), condition (object), initial (object), reduce (function), finalize (function), [options] (object), callback
collection.group({"id":true}, null, {}, function (curr, result) {
result._id = curr._id;