Skip to content

Instantly share code, notes, and snippets.

tkr kgtkr

Block or report user

Report or block kgtkr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kgtkr
kgtkr / gist:3d9dd726607d9c73bde10ee3b604741f
Last active Feb 22, 2019
@kgtkr ブロックされているリスト
View gist:3d9dd726607d9c73bde10ee3b604741f
__yumechi 3115850400
theoldmoon0602 731925661
udoooom 2334741871
691_7758337633 850331932130811906
_tyru_ 232331457
h1manoa 1477133816
PDB_Yukari_kt 754635387096543232
rp88u 750617607846260736
tomykaira_2 968768458166030336
_mono 35741880
View bykey.rs
struct ByKey<T, K, F: Fn(&T) -> &K>(T, F);
impl<T, K: Eq, F: Fn(&T) -> &K> Eq for ByKey<T, K, F> {}
impl<T, K: PartialEq, F: Fn(&T) -> &K> PartialEq for ByKey<T, K, F> {
fn eq(&self, other: &Self) -> bool {
self.1(&self.0) == other.1(&other.0)
}
}
impl<T, K: Ord, F: Fn(&T) -> &K> Ord for ByKey<T, K, F> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.1(&self.0).cmp(other.1(&other.0))
View app.js
function unflatten(arr, c) {
return arr.reduce((r, x, i) => {
if (i % c == 0) {
r.push([]);
}
r[r.length - 1].push(x);
return r;
}, []);
}
@kgtkr
kgtkr / main.c
Created Mar 15, 2018
bit2int(c)
View main.c
#include <stdio.h>
int pow(int x, int p)
{
int r = 1;
for (int i = 0; i < p; i++)
{
r *= x;
}
return r;
@kgtkr
kgtkr / main.hs
Created Mar 15, 2018
bit2int(hs)
View main.hs
main :: IO ()
main = print $ bit2int "11111111" 0
bit2int :: [Char] -> Int -> Int
bit2int [] x = x
bit2int ('0':ss) x = bit2int ss x
bit2int ('1':ss) x = bit2int ss x + 2 ^ length ss
bit2int _ _ = undefined
@kgtkr
kgtkr / main.js
Created Feb 1, 2018
お寿司復元
View main.js
const fs = require("fs");
const mkdirp = require('mkdirp');
const path = require('path');
function isExistFile(file) {
try {
fs.statSync(file);
return true
} catch (err) {
if (err.code === 'ENOENT') return false
View main.rs
extern crate clap;
extern crate egg_mode;
extern crate futures;
extern crate tokio_core;
use clap::{App, Arg};
use tokio_core::reactor::Core;
fn main() {
let app = App::new("time-tweet")
@kgtkr
kgtkr / README.md
Last active Sep 27, 2017
限界突破
View README.md

使い方

  1. javascript:を先頭に付けてブックマークに登録
  2. 140文字以上入力
  3. さっき登録したブックマークをクリック
View gist:e5ace6cc6897de1e4c758d5ab4270514
document.addEventListener('click',e=>{
e.target.parentNode.removeChild(e.target)
}, false);
@kgtkr
kgtkr / menu-transpile.js
Last active Sep 24, 2017
新月朔 moonlight
View menu-transpile.js
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
You can’t perform that action at this time.