Skip to content

Instantly share code, notes, and snippets.

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

Masato Sogame pocket7878

🏠
Working from home
View GitHub Profile
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import {terser} from 'rollup-plugin-terser';
//Common JS Configurations
const commonJsConfigs = ['development', 'production'].map(mode => ({
input: 'src/Recoil_index.js',
output: {
@dynamicCallable
class GFun<T,R> {
var versions: [(([T]) -> Bool, (([T]) -> R))] = []
func dynamicallyCall(withArguments args: [T]) -> R {
return versions.first { (entry) -> Bool in
return entry.0(args)
}!.1(args)
}
@pocket7878
pocket7878 / .ec.yaml
Created January 27, 2017 05:32
Ec Preference example
fontName: "Go Mono"
fontSize: 12
autoIndent: true
expandTab: true
fileTypes:
- path: "^.*\.go$"
expandTab: false
- path: Makefile
expandTab: false
@pocket7878
pocket7878 / gakufu-me.rb
Created February 23, 2016 02:50
Extract Chord information from gakufu.me page
require 'open-uri'
require 'nokogiri'
if ARGV.count != 1
puts "Please specify gakufu.me url"
exit 1
end
#url = 'http://gakufu.me/song/178834/'
url = ARGV[0]
@pocket7878
pocket7878 / hitofude.cpp
Created December 27, 2015 14:44
Hitofudegaki C++
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct vect2 {
int x;
int y;
};
# coding: utf-8
# In[5]:
from PIL import Image, ImageDraw
from matplotlib.pyplot import imshow
import numpy as np
import random
@pocket7878
pocket7878 / paris.py
Created November 15, 2015 07:05
paris.py
from PIL import Image, ImageDraw
import photos
import console
base = photos.capture_image()
w = base.size[0]
h = base.size[1]
paris = Image.new(base.mode, base.size, "white")
@pocket7878
pocket7878 / Level.hs
Created October 9, 2015 09:02
Building Tree from Tree Data.
import Data.List
data L = L (Maybe L) Int deriving (Eq)
instance Show L where
show (L Nothing l1) = show l1
show (L (Just p) l1) = (show p) ++ "." ++ (show l1)
instance Ord L where
(L Nothing l1) `compare` (L Nothing l2) = l1 `compare` l2
@pocket7878
pocket7878 / forloop.m4
Last active July 3, 2022 21:21
prime.m4
define(`forloop',
`pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop',
`ifelse(eval($1 < `$3'), 1,
`$4`'define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
@pocket7878
pocket7878 / fizz-buzz.m4
Created July 18, 2015 12:40
FizzBuzz in m4
define(`forloop',
`pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop',
`$4`'ifelse($1, `$3', ,
`define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
forloop(`i', 1, 1000,
`ifelse(eval(i % 15 == 0), 1, FizzBuzz
,ifelse(eval(i % 5 == 0), 1, Fizz
,ifelse(eval(i % 3 == 0), 1, Buzz