Skip to content

Instantly share code, notes, and snippets.

@seka
seka / Sample.swift
Created Apr 27, 2020
NSDataとCFDataの関係をメモ (Toll-Free Bridge)
View Sample.swift
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 Oct 21, 2018
HTML から Android のコンポーネントを作成してみるサンプル
View HTMLConverter.kt
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 Oct 25, 2016
リクエストのサンプル
View gist:bf0a7ec699aaf0fa2368590f11044aad
{
"lunch_id": int,
"separateSize": int,
"members": [
{
"user_id": int,
"user_name": string,
"user_sex": boolean
"user_expense_times": int
"user_select_shop_times": int
View alphabetical.json
{
"sort-order": [
"align-content",
"align-items",
"align-self",
"-o-animation",
"-ms-animation",
"-moz-animation",
"-webkit-animation",
"animation",
@seka
seka / gist:c5894488d7e07d583630
Created Jan 31, 2016
postcss-style-guide のテストに使ったファイル
View gist:c5894488d7e07d583630
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 Nov 12, 2015
setup script of nginx.
View setup-nginx.sh
# 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 Sep 30, 2015
gnatsdのclusterについて, confファイルの設定方法をメモ
View sample-cluster.conf
# クライアントからは以下のようにして接続
# nats://user:password@localhost:4242
port: 4242
authorization {
user: user
password: password
}
# クラスタの設定
cluster {
@seka
seka / sample.html
Created Aug 27, 2015
An invalid form control with name='' is not focusable.
View sample.html
<!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 Apr 18, 2015
Ameba Owndのある記事からデータを抜き出すために作ったスクリプト
View Ownd.coffee
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 Aug 29, 2015
node.jsでmongooseを使っている際、純粋なgroup メソッドを利用する。
View 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;