Skip to content

Instantly share code, notes, and snippets.

@ikekou
ikekou / main.js
Created August 15, 2014 11:19
node.jsとphantomasで複数回計測していくつかの項目で平均とる
var exec=require('child_process').exec;
var arr=[
'requests',
'httpsRequests',
'bodySize',
'contentLength',
'httpTrafficCompleted',
'timeToLastByte',
@ikekou
ikekou / main.sh
Created August 15, 2014 09:27
[node.js][phantomas] phantomasでURL指定して計測
$ phantomas --url http://google.com
@ikekou
ikekou / capture.js
Last active August 29, 2015 14:05
[node.js][javascript][phantomjs] phantomjsでスクリーンキャプチャ
var page = require('webpage').create();
var width = 1200;
var height = 768;
page.viewportSize = {
width: width,
height: height
};
page.open('http://localhost:8000/', function () {
@ikekou
ikekou / main.sh
Last active August 29, 2015 14:05
placehold.jpから連番画像をダウンロードする
$ curl -o '#1.png' http://placehold.jp/888888/ffffff/40x40.png?text=[1-100]
@ikekou
ikekou / main.py
Created August 12, 2014 11:27
ディレクトリにあるph_001.jpgっていうファイルを1.jpgにリネームする
# -*- coding: utf-8 -*-
import os
import sys
import os.path
dir = './'
files = os.listdir(dir)
for file in files:
print '--'
@ikekou
ikekou / gulpfile.coffee
Last active August 29, 2015 14:04
[node.js][gulp.js][coffeescript] gulpつかってみたテンプレ
# modules
gulp = require 'gulp'
connect = require 'gulp-connect'
coffee = require 'gulp-coffee'
gutil = require 'gulp-util'
sourcemaps = require 'gulp-sourcemaps'
concat = require 'gulp-concat'
gulpif = require 'gulp-if'
uglify = require 'gulp-uglify'
@ikekou
ikekou / gist:6493006
Created September 9, 2013 08:37
[Objective-C] 1回だけ使うタイマーみたいな書き方
[self performSelector:@selector(timerHandler) withObject:nil afterDelay:1.0];
@ikekou
ikekou / gist:5992631
Created July 13, 2013 23:55
[jade][php] jadeでhtmlタグとかphpタグとか、エンコードしたくないものを書く場合
// !が重要。テキスト部分に関しては特に何もしなくても大丈夫。属性値部分は=だけだとエンコードされちゃう。
a(href!='<?php echo $foo; ?>') <?php echo $foo; ?>
@ikekou
ikekou / gist:5990479
Created July 13, 2013 11:52
[ImageMagick] ImageMagickのmontageで、時計回りに90度回転させた画像を縦最大300pxでリサイズして横方向に並べて1枚の画像にする
montage -rotate 90 -resize x300 -geometry +0+0 -tile x1 in0.png in1.png out.png
@ikekou
ikekou / gist:5939307
Last active December 19, 2015 10:19
[CoffeeScript][JavaScript][CreateJS] Event.ADDED_TO_STAGEのかわり
class Hoge
constructor:()->
createjs.Ticker.addEventListener('tick',@_checkStage)
_checkStage:()=>
if @getStage()
createjs.Ticker.removeEventListener('tick',@_checkStage)
createjs.Ticker.addEventListener('tick',@_onTick)