Skip to content

Instantly share code, notes, and snippets.

View sisidovski's full-sized avatar

Shunya Shishido sisidovski

View GitHub Profile
@sisidovski
sisidovski / app.js
Created May 29, 2012 13:52
LINE 非公式 API を使ってログイン
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
@sisidovski
sisidovski / xpathでi当該テキストノードのndexを取得するあれやこれや
Created February 18, 2013 11:08
xpathでindex指定のテキストノードは簡単に取れるが、任意のテキストノードのindexがなかなかとれなくて苦戦した。
$x("//tr[@name='tag'][child::td[.='hoge']]")
$x("//tr[@name='tag'][child::td[.='hoge']]/preceding-sibling::tr[@name='tag']")
$x("count(//tr[@name='tag'][child::td[.='hoge']]/preceding-sibling::tr[@name='tag'])") // countを取る
$x("//tr[child::td[text()='TestTag']]/preceding-sibling::tr[@name='tag']") // 前方のWebElementsを取る→findElementsでこいつのsize()とった方がいい?
これに1加算するのがいい感じっぽい
@sisidovski
sisidovski / socket.php
Created March 29, 2013 04:53
PHPでソケット通信、こんな感じですかね。
<?php
// port number
$port = 8081;
// open the socket
$socket = socket_create_listen($port);
if ($socket === false) die("Error");
while (true) {
// accept a request
$client = socket_accept($socket);
while (true) {
@sisidovski
sisidovski / Info.plist
Created April 4, 2013 04:35
IntelliJ IDEAで日本語メソッドを扱うための設定
<key>VMOptions</key>↲
<string>-ea -Dfile.encoding=UTF-8 -Dsun.io.useCanonCaches=false -Xverify:none -Xbootclasspath/a:../lib/boot.jar</string>↲
<key>WorkingDirectory</key>↲
<string>$APP_PACKAGE/bin</string>↲
@sisidovski
sisidovski / gist:5899733
Last active December 19, 2015 04:49
groovyでrssフィード取得(適当
def getFeed() {
// dbからリスト取得
def tableData = Rsslist.list()
def feedList = []
// urlからパース
for (column in tableData) {
def url = column.url
def root = new XmlSlurper().parse(url)
def nodes
@sisidovski
sisidovski / file0.txt
Created December 10, 2013 17:57
IntelliJ IDEAでファイル保存時にcode formatする ref: http://qiita.com/ssd/items/bde2d844c3c73457923c
Reformat codeのダイアログが表示されるので、セレクトボックスは現在のファイルを、下のOnly VCS changed textにチェックを入れる。Do not show this dialog in the futureにもチェックを入れてしまおう。もしこのダイアログを再表示したくなったら、Preferences -> Editor -> Formatting -> Show "Reformat code" dialog にチェックを入れればOK
@sisidovski
sisidovski / table.html
Created January 22, 2014 08:17
table bug on chrome 32 ?
<!doctype html>
<html>
<body>
<style>
td {
padding: 0px;
}
</style>
<table border="0">
<tbody>
@sisidovski
sisidovski / hacks.js
Last active August 29, 2015 14:17 — forked from notmasteryet/hacks.js
(function() {
try {
var a = new Uint8Array(1);
return; //no need
} catch(e) { }
function subarray(start, end) {
return this.slice(start, end);
}
@sisidovski
sisidovski / corser.md
Last active February 16, 2017 14:31
corsでのローカル開発

X-Requested-Withとかなんでもいいけどヘッダをクライアント側にも付与する必要がある。 PUTとかDELETEのときはpreflightリクエストが投げられる

var corser = require("corser");
app.use(corser.create({
  methods: corser.simpleMethods.concat(["DELETE", "OPTIONS"]),
  requestHeaders: corser.simpleRequestHeaders.concat(["X-Requested-With"])
}));
What is the best solution for icons?
1. Icon fonts
1. - Bigger download
2. - Hard to maintain
3. - Can break badly
4. + Super easy to style
2. <img src=‘something.svg’>
1. - Requires asset path in HTML
2. - Impossible to change style