Skip to content

Instantly share code, notes, and snippets.

@hadashiA
hadashiA / file0.txt
Last active March 4, 2016 08:29
Elasticsearchを使ってレコメンデーションする ref: http://qiita.com/hadashiA/items/9a418df95f8611c041a2
$ plugin --url 'https://github.com/f-kubotar/elasticsearch-flavor/releases/download/v0.0.2/elasticsearch-flavor-0.0.3.zip' --install flavor
// 画像をpngとかjpegにエンコードするライブラリです。
// https://code.google.com/p/as3corelib/downloads/list
import com.adobe.images.*;
// バイナリをBase64エンコードするライブラリです。
// http://crypto.hurlant.com/
import com.hurlant.util.Base64;
// SUZURIにPOSTする
function postSuzuri(event: MouseEvent): void {
package main
import (
"fmt"
"math"
)
func Sqrt10(x float64) float64 {
var z float64 = x
@hadashiA
hadashiA / file0.txt
Last active August 29, 2015 14:10
Imagemagickの高速化 mprとmpc ref: http://qiita.com/hadashiA/items/bf10881943a41fee238d
# hoge という字の画像を生成
$ convert -size 200x200 -background transparent -fill black -gravity Center label:hoge png:- | \
# それをbg.png と合成する
$ convert -composite - bg.png hoge.png
LDFLAGS=" -L/app/vendor/libjpeg-turbo-1.3.1/lib -L/app/vendor/libpng-1.6.12/lib $LDFLAGS" ./configure --prefix=/app/vendor/imagemagick-6.8.9-3 --enable-shared=no --enable-static=yes
@hadashiA
hadashiA / file0.txt
Created April 16, 2014 13:28
jsの設定ファイルをcoffeeで書く方法 ref: http://qiita.com/hadashiA/items/2b51bdbecf65a6f25ef7
$ npm install --save coffee-script
convert -resize 323x323 -unsharp 2x1.4+0.5+0 hoge.png fuga.png
@hadashiA
hadashiA / gist:9449924
Created March 9, 2014 16:01
画像がロードされてなかったら終わるまで一時的にロード中画像に差し替える
$(function() {
$('.lens-image').each(function() {
var img = this
, src = this.src
, loader = new Image;
if (!this.complete || (!img.naturalWidth === 0)) {
img.src = './img/animation.gif';
loader.src = src;
loader.onload = function() {
@hadashiA
hadashiA / gist:8649686
Created January 27, 2014 14:40
一本のReadableStreamを、二本のReadableStreamにする
fs = require 'fs'
gm = require 'gm'
im = gm.subClass imageMagick: true
{PassThrough} = require 'stream'
stream = fs.createReadStream '/Users/hadashi/tmp/20.png'
stream2 = new PassThrough
stream3 = new PassThrough
@hadashiA
hadashiA / brunch_server.coffee
Created November 17, 2013 14:34
Grunt止めて、mincer止めて、Brunchに乗り換えた ref: http://qiita.com/hadashiA/items/9f5fb4134bf87a560b82
{exists} = require('fs')
{EventEmitter} = require('events')
{resolve, join} = require('path')
{filter} = require('async')
http = require('http')
cordell = require('cordell')
{config} = require('./config')
class BrunchServer extends EventEmitter