Skip to content

Instantly share code, notes, and snippets.

View Leko's full-sized avatar
🏠
Working from home

Shingo Inoue Leko

🏠
Working from home
View GitHub Profile
@Leko
Leko / filedrop.js
Created July 4, 2013 10:31
ブラウザにファイルをドロップし、情報と内容を表示するhtmlとjs
(function(global, $) {
"use strict";
var util = {
// ブラウザのデフォルトの動作と、イベントの伝播をキャンセルする
stop: function(e) {
e.preventDefault();
e.stopPropagation();
},
// strを指定の長さで切り取る
@Leko
Leko / jquery.filedrop.js_demo.html
Last active December 19, 2015 08:39
jquery.filedrop.jsのデモデモ用HTMLです。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 でドラッグ&ドロップ</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="jquery.drop-file.js"></script>
<script>
// strを指定の長さで切り取りtailをくっつける
function cutoff(str, len, tail) {
@Leko
Leko / jquery.filedrop.js
Last active December 19, 2015 08:39
This is a jQuery plugin that is wrapper library of Drag and Drop API.
;(function(global, $) {
"use strict";
/**
* 呼び出し元のjQueryオブジェクトをファイルドロップ可能にする
* @param {Object} opt 設定ファイル
* @return {this} 呼び出し元のjQueryオブジェクト
*/
$.fn.fileDrop = function(opt) {
@Leko
Leko / AOJ_0168.cpp
Created July 4, 2013 16:15
AOJ 0168 Kannondou http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0168 漸化式が問題文に書いてあるのでそれをメモ化して取り出すだけ。
#include <iostream>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
int main() {
int n;
@Leko
Leko / AOJ_1156.cpp
Created July 12, 2013 03:52
AOJ 1156 Twirling Robot http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1156&lang=jp コストで昇順にしたpriority queueを使って、あとはdfs。ダイクストラ法ってやつなのかな
// start: 2013/07/11 3:12
// end: 2013/07/12 12:50
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for ( int i = 0; i < n; i++ )
#define INF INT_MAX
@Leko
Leko / AOJ_1153.cpp
Created July 12, 2013 03:54
AOJ 1153 Equal Totaol Score http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1153&lang=jp nが100以下なので全探索。
// start: 2:41
// AC: 3:02
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for ( int i = 0; i < n; i++ )
#define MP(a, b) make_pair(a, b)
#define MAX 101
@Leko
Leko / AOJ_2254.cpp
Created July 12, 2013 03:55
AOJ 2254 Fastest Route http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2254&lang=jp ビットDP。いまいちわからん。
// start: 1:45
// AC: 2:34
#include <cmath>
#include <iostream>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
@Leko
Leko / ICPC2013_C.cpp
Last active December 19, 2015 16:48
ICPC 国内予選C(サンプルは通った,ジャッジデータは試せてない)
// start: 0:34
// end: 2:00
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
<?php
error_reporting(1);
require("workflows.php");
// 設定ファイルに登録されたユーザ名を返す
function get_user_name() {
$f = fopen("./user", "r");
return fgets($f);
}
@Leko
Leko / fetch_title.php
Created July 14, 2013 08:58
Markdown Link Generator
<?php
require_once('workflows.php');
$wf = new Workflows();
$url = "{query}";
// htmlを取得してtitleタグを抜き出し
$html = $wf->request($url);
preg_match("/<title>(.*?)<\/title>/i", $html, $match);