Skip to content

Instantly share code, notes, and snippets.

View shisama's full-sized avatar

Masashi Hirano shisama

View GitHub Profile
import React from "react";
import svg from "./sample.svg";
export default class Sample extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
@shisama
shisama / package.json
Last active October 19, 2017 15:15
comile sass to css with autoprefixer and webpack
{
"name": "sass-autoprefixer-sample",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build-css": "rm -rf public && webpack --debug --config webpack.config.js"
},
"author": "",
@shisama
shisama / gulpfile.js
Created October 19, 2017 16:13
compile sasst to css with gulp and autoprefixer
const gulp = require("gulp");
const sass = require("gulp-sass");
const autoprefixer = require("gulp-autoprefixer");
const plumber = require("gulp-plumber");
const path = require("path");
gulp.task("build-css", function() {
gulp.src(path.join(__dirname, "src", "css", "*.sass"))
.pipe(plumber())
.pipe(sass())
@shisama
shisama / v8-ES-NewFeature.md
Last active November 30, 2017 13:55
V8 6.3, ECMAScript New Features

V8 6.3で追加されたECMAScriptの機能 (Dynamic import、Asynchronous Iteration、 Promise.prototype.finally)

この記事ではV8に追加されたECMAScriptの機能を簡単に説明します。

V8 6.3が2017年10月25日にリリースされ、Chrome 63で使われています。(参考: V8 JavaScript Engine) このリリースではECMAScriptのstage-3から3機能が追加されました。 そのうちNode.jsにも入るでしょう。

harmonyオプションやライブラリを使用すれば現時点(2017/12/02)でも使用可能です。 Node8、Node9またはChromeで実行できるサンプルを用意しています。

V8 6.3 shipped New ECMAScript features

V8 released 6.3 on October 25, 2017 (see: V8 JavaScript Engine) It includes new features from ECMAScript proposal stage-3 It seems likely that they will also soon be implemented in Node.js

Now, you can try them with --hamony options or 3rd party libraries. I developed demo on GitHub

@shisama
shisama / CodePiece.swift
Last active January 15, 2018 16:17 — forked from es-kumagai/CodePiece.swift
Swiftでは++が使えないので、その代わりにcount変数をカウントアップする関数で代用 #minna_de_swift
let fibonacci = sequence(state: (current: 0, next: 1)) { state -> Int in
defer {
state = (current: state.next, next: state.current + state.next)
}
return state.current
}
let values = Array(fibonacci.prefix(13))
var count = 0
@shisama
shisama / pulsator.css
Last active February 3, 2018 14:23
pulse animation with css
.pulsator {
display: block;
width: 15px;
height: 15px;
border-radius: 50%;
border-color: red;
background: red;
cursor: pointer;
box-shadow: 0 0 0 rgba(255,0,0, 0.4);
animation: pulse 1.5s infinite;
@shisama
shisama / file0.js
Last active March 1, 2018 10:50
Web Animations APIを使った波紋アニメーション(ripple effect) ref: https://qiita.com/shisama/items/c1cf3c52695ff17aff48
const el = document.querySelector(".pulsator");
const style = {
width: "15px",
height: "15px",
borderRadius: "50%",
borderColor: "red",
background: "red",
boxShadow: "0 0 0 rgba(255,0,0, 0.4)"
};
Object.assign(element.style, style);
@shisama
shisama / file0.txt
Created April 15, 2018 15:28
V8 6.3で追加されたECMAScriptの機能 (Dynamic import、Asynchronous Iteration、 Promise.prototype.finally) ref: https://qiita.com/shisama/items/f7029822a5848592cbc2
if (member.isLoggedIn()) {
// ログインしている場合はmoduleAの関数を使いたい
} else {
// ログインしていない場合はmoduleBの関数を使いたい
}
@shisama
shisama / Java7.java
Last active July 5, 2018 04:05
Java8 ラムダ式でComparatorのコールバック関数を簡単に書く方法 ref: https://qiita.com/shisama/items/1ba7e4f0000d4e7a9b5e
Collections.sort(list, new Comparator<Person>(){
@Override
public int compare(Person p1, Person p2) {
int ret = p1.getId() - p2.getId();
if (ret == 0) {
ret = p1.getName().compareTo(p2.getName());
}
if (ret == 0) {
ret = p1.getAge() - p2.getAge();
}