Skip to content

Instantly share code, notes, and snippets.

@wgkoro
wgkoro / test.md
Created February 3, 2014 09:19
test

今日の晩ご飯

  • ハンバーグ
  • 焼きそば
  • たこ焼き
@wgkoro
wgkoro / csv.py
Created March 7, 2014 10:47
PythonでCSV開いてほげふがするサンプル
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import csv
csvfile = open('hoge.csv', 'r')
reader = csv.reader(csvfile)
for i, row in enumerate(reader):
if not i:
continue
@wgkoro
wgkoro / util.php
Created March 31, 2014 07:07
PHPでよく使うやつ
<?php
class Util{
// アンダースコア「_」区切りでCamelCaseに変換する
public static function toCamelCase($string){
$camel_case = "";
$string_arr = explode("_", $string);
foreach($string_arr as $name){
if(empty($name)){ continue; }
@wgkoro
wgkoro / nginx_proxy_cache_purge.php
Created April 21, 2014 16:52
WordPressのNginx Proxy Cache Purgeプラグイン改造版。
<?php
/*
Plugin Name: Nginx Proxy Cache Purge
Plugin URI: http://wpselect.com/
Description: Purges the nginx proxy cache when you publish or update a post or page.
Version: 0.9.6
Author: John Levandowski
Author URI: http://wpselect.com/
*/
@wgkoro
wgkoro / flickr_credit_pc.js
Last active August 29, 2015 14:00
Flickr Credit bookmarklet
javascript:(function(){
var a,title,
divs = document.getElementsByTagName('div'),
len = divs.length;
for(var i=0;i<len;i++){
if(divs[i].className == 'attribution-info'){
a = divs[i].getElementsByTagName('a')[0];
break;
}
}
@wgkoro
wgkoro / filickr_credit_mobile.js
Last active August 29, 2015 14:00
Flickr credit for mobile
javascript:(function(){
var title,a,
divs = document.getElementsByTagName('div'),
len = divs.length;
for(var i=0;i<len;i++){
if(divs[i].className.match(/photo_meta/)){
title = divs[i].getElementsByTagName('h2')[0].childNodes[0].nodeValue.replace(/ /g, '').replace(/\t/g, '').replace(/\n/g, '');
break;
}
}
(NeoBundleUpdate時にエラー)
[neobundle/install] ( 2/39): |vimproc| git pull --rebase && git submodule update --init --recursive
function neobundle#commands#install..<SNR>27_install..neobundle#installer#sync..neobundle#installer#get_revision_number..neobundle#util#system..vimpro
c#system..<SNR>113_system..vimproc#pgroup_open..<SNR>113_pgroup_open..vimproc#plineopen3..<SNR>113_plineopen..<SNR>113_convert_args..vimproc#get_comma
nd_name の処理中にエラーが検出されました:
行 5:
E119: Not enough arguments for function: vimproc#filepath#which
E116: 関数の無効な引数です: vimproc#util#substitute_path_separator( vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n')
E116: 関数の無効な引数です: substitute(vimproc#util#substitute_path_separator( vimproc#filepath#which(a:command, path)), '//', '/', 'g'), '\n')
@wgkoro
wgkoro / keycode_check.html
Created October 6, 2014 07:41
キーコードを確認するためのHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
$(function(){
$('#target').on({
keyup : function(e){
@wgkoro
wgkoro / 0017.py
Last active August 29, 2015 14:17
AOJ-0017 Caesar Cipher
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, string
alphabet = 'abcdefghijklmnopqrstuvwxyza'
table = string.maketrans(alphabet[:-1], alphabet[1:])
for s in sys.stdin:
while not('the' in s or 'this' in s or 'that' in s):
s = s.translate(table)
@wgkoro
wgkoro / file_write_in_try-catch.php
Last active August 29, 2015 14:25
try{ }catch の中でファイル書き込みを実行し、例外なげたらどうなるんだっけ?
<?php
// 結果:例外なげてもファイルに書き込まれる
try {
$fp = fopen('./fugafuga.log', 'a');
fwrite($fp, '123');
fclose($fp);
throw new Exception('e');
}
catch(Exception $e) {