Skip to content

Instantly share code, notes, and snippets.

View endaaman's full-sized avatar
💭
Neovim

Ken Enda endaaman

💭
Neovim
View GitHub Profile
@endaaman
endaaman / i.lua
Last active December 28, 2018 07:40
local tym = require('tym')
function fit()
local model = tym.get_monitor_model()
print('fitting', model)
if model == 'DVI-I-1' then
tym.set('font', 'Monospace 16')
tym.apply()
end
return true
@endaaman
endaaman / prime.rb
Last active October 28, 2017 17:05
start_time = Time.now
max = 1000000
table = Array.new(max + 1, true)
prime_list = [2]
num = 3
if table[num] == true
prime_list << num
@endaaman
endaaman / ihiji.js
Created November 3, 2016 09:12
一次回帰直線の傾き
// 土 10/01 23/13 0 mm 0 cm 19/10
// 日 10/02 25/12 0 mm 0 cm 19/10
// 月 10/03 20/15 6 mm 0 cm 19/10
// 火 10/04 20/12 0 mm 0 cm 19/9
// 水 10/05 17/11 2 mm 0 cm 19/9
// 木 10/06 16/10 9 mm 0 cm 19/9
// 金 10/07 15/9 0 mm 0 cm 18/9
// 土 10/08 17/9 0 mm 0 cm 18/8
// 日 10/09 16/10 0 mm 0 cm 18/8
// 月 10/10 11/7 0 mm 0 cm 18/8
set smoothscroll
map l nextTab
map h previousTab
map J scrollPageDown
map K scrollPageUp
map <C-n> nextTab
map <C-p> previousTab
copyTitle -> {{
var title = document.title
document.addEventListener('copy', function(e) {
@endaaman
endaaman / manage_module_cache.js
Last active March 21, 2016 21:09
How to get module caches which the module is depending on and remove them
function extractDependingModuleCaches(name) {
function inner(name, targets) {
targets[name] = true
Object.keys(require.cache[name].children).forEach(function(key) {
var child = require.cache[name].children[key]
inner(child.filename, targets)
})
return targets
}
return targets = Object.keys(inner(name, {}))
<html>
<body>
<div id="audioElementList"></div>
<input type="text" id="userInput">
<button id="connectButton">connect</button>
</body>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
<script type="text/javascript">
@endaaman
endaaman / _color.sass
Created October 9, 2015 08:46
Google Material Design Colors
// http://www.google.com/design/spec/style/color.html#color-color-palette
$red-50: #ffebee
$red-100: #ffcdd2
$red-200: #ef9a9a
$red-300: #e57373
$red-400: #ef5350
$red-500: #f44336
$red-600: #e53935
$red-700: #d32f2f
@endaaman
endaaman / チンポソイヤw.coffee
Created September 30, 2015 10:11
チンポソイヤw
Twitter = require 'twitter'
co = require 'co'
client = new Twitter
consumer_key: 'ち'
consumer_secret: 'ん'
access_token_key: 'ぽ'
access_token_secret: 'w'
posts = 'ウェイ↑チンポソイヤw'.split('').reverse()
# https://twitter.com/runa1210248/status/628554882966945795
all = []
gen = (tree, list)->
if tree.length is 0
all.push list.concat()
return
[0..tree.length-1].forEach (v, i)->
var url = require('url');
var querystring = require('querystring');
prettifyUrl = function (uglyUrl) {
var oldUrlObj = url.parse(uglyUrl);
var queryObj = querystring.parse(oldUrlObj.query);
if ('_escaped_fragment_' in queryObj) {
var escapedFragment = queryObj._escaped_fragment_;
delete queryObj['_escaped_fragment_'];