Skip to content

Instantly share code, notes, and snippets.

View chitoku-k's full-sized avatar
🐱
Becoming a cat

Chitoku chitoku-k

🐱
Becoming a cat
View GitHub Profile
@chitoku-k
chitoku-k / webpack.config.js
Last active June 3, 2017 11:22
webpack.config.js
import { path } from 'path';
import { glob } from 'glob';
import { webpack } from 'webpack';
const entries = Object.assign(
...glob.sync('./app/webroot/scripts/js/test/**/entry.js')
.map(file => ({ [ path.basename(path.dirname(file)) ]: file }))
);
console.log(Object.keys(entries))
@chitoku-k
chitoku-k / call-neovim-from-shell.sh
Last active May 5, 2017 18:13
Call Neovim from shell script
python3<<<"import neovim; neovim.attach('socket', path='$NVIM_LISTEN_ADDRESS').input('<C-\\><C-n>')"
@chitoku-k
chitoku-k / babel.html
Last active May 2, 2017 17:36
babel-standalone
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="app" style="display: none" :style="{ display: 'block' }">
<input type="button" value="ホモを出す" v-on:click="activate">
<ul>
@chitoku-k
chitoku-k / .travis.linux.yml
Last active September 2, 2022 06:33
ChromeDriver on Travis CI
os: linux
node_js: '12'
sudo: required
env: DISPLAY=':99.0'
dist: trusty
addons:
apt:
update: true
sources:
- google-chrome
@chitoku-k
chitoku-k / non-blocking-fwrite.php
Created January 22, 2017 13:55
ブロックしない fwrite(のはずが全然速くならなかった)
<?php
$str = str_repeat(PHP_VERSION, 200000);
$len = strlen($str);
$r = null;
$e = null;
$w = [];
$bytes = [];
foreach (range(1, 100) as $i) {
$w[] = $fp = fopen("test{$i}.txt", 'wb');
/* タイトルと URL コピーするやつ */
!function (document) {
var text = prompt("コメント:");
if (text == null) {
return;
}
text = text === "" ? "" : text + "\n\n";
var body = document.body;
var element = document.createElement("textarea");
using System;
/// <summary>
/// <see cref="System.ValueType"/> への拡張メソッドを提供します。
/// </summary>
public static class ValueTypeExtensions
{
/// <summary>
/// 文字列形式を、<see cref="System.Boolean"/> に変換します。変換できない場合は <c>null</c> を返します。
/// </summary>
#include <stdio.h>
int main(int n, char **m) {
FILE *p, *q;
int A, k, a, r, i;
char *d = "P%" "d\n%d\40%d" "\n%d\n\00wb+",
b[1024],
y[] = "yuriyurarararayuruyuri*daijiken**akkari~n**"
"/y*u*k/riin<ty(uyr)g,aur,arr[a1r2a82*y2*/u*r{uyu}riOcyurhiyua**rrar+*arayra*="
"yuruyurwiyuriyurara'rariayuruyuriyuriyu>rarararayuruy9uriyu3riyurar_aBrMaPrOaWy^?"
<?php
function GetVersion($command, $pattern = '/([\d.]*[\d])/') {
if (preg_match($pattern, shell_exec($command), $matches)) {
return $matches[1];
}
return false;
}
$versions = [
'php' => phpversion(),
@chitoku-k
chitoku-k / bookmarklet.js
Created March 3, 2015 15:25
コメント付きツイート用ブックマークレット
void(function(){var c=prompt("コメント:");c=c===""||c===null?"":c+"\n\n";window.open("http://twitter.com/share?text="+encodeURIComponent(c+document.title+" -")+"&url="+location.href,"share","height=400,width=600,left="+(screen.width/2-600/ 2) + ",top=" + (screen.height/2-400/2))})();