Skip to content

Instantly share code, notes, and snippets.

View axross's full-sized avatar
🍣
= 🍚 + 🐟 + ❤️

Kohei axross

🍣
= 🍚 + 🐟 + ❤️
View GitHub Profile
function javaenv
if test (count $argv) -eq 0
/usr/libexec/java_home -V
else
switch $argv[1]
case 'ls'
/usr/libexec/java_home -V
case 'set'
set -xU JAVA_HOME (/usr/libexec/java_home -v $argv[2])
end
import 'package:barcode_scan/barcode_scan.dart';
import '../entity/friend_code.dart';
import '../entity/scaned_friend_code.dart';
class FriendCodeScanService {
Future<FriendCode> scan() async {
String data;
try {
data = await BarcodeScanner.scan();
typedef bool Predicate(T);
List<T> filter<T>(List<T> list, Predicate predicate) {
final newList = [];
for (final item in list) {
if (predicate(item)) {
newList.add(item);
}
}
@axross
axross / jquery.min.js
Last active January 16, 2018 14:49
jQuery
window.$ = (arg) =>
typeof arg === 'function'
? window.document.addEventListener('DOMContentLoaded', arg)
: window.document.querySelector(arg);
window.$.ajax = window.fetch;
type Params = {};
type ContextBase<R, C> = {
router: Router<R, C>;
route: Route<R, C>;
next: () => Promise<R>;
url: string;
baseUrl: string;
path: string;
params: Params;
import { css } from 'glamor';
import * as React from 'react';
type Direction = 'row' | 'row-reverse' | 'column' | 'column-reverse';
type Wrap = 'nowrap' | 'wrap' | 'wrap-reverse';
type JustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
type AlignItems = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
type AlignContent = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around';
type Length = number | string;
const Counter = ({ count, onIncrementClick, onDecrementClick, onIncrementAsyncClick }) => (
<div>
{count}
:
<button onClick={onIncrementClick}>+</button>
/
<button onClick={onDecrementClick}>-</button>
/
<br/>
<button onClick={onIncrementAsyncClick}>+ Async</button>
Compiling study_lang v0.1.0 (file:///Users/axross/Dropbox/Workspace/study-rust/study_lang)
error[E0277]: the trait bound `Humanoid: Walkable` is not satisfied
--> src/main.rs:68:3
|
68 | shift(humanoid);
| ^^^^^ the trait `Walkable` is not implemented for `Humanoid`
|
= note: required by `shift`
error: aborting due to previous error
@axross
axross / FlatButton.ts
Created December 20, 2016 07:32
CSS in JS using styled-components
import * as React from 'react';
import styled from 'styled-components';
import {
WHITE, MIDNIGHT,
SILVER, LIGHT_SILVER, DARK_SILVER,
RED, LIGHT_RED, DARK_RED,
BLUE, LIGHT_BLUE, DARK_BLUE,
} from '../../constants/colors';
import { SHORT_DURATION } from '../../constants/duration';
import { REGULAR_HORIZONTAL_MARGIN, REGULAR_RADIUS_LENGTH } from '../../constants/size';
@axross
axross / SigninForm.tsx
Created December 20, 2016 04:22
Wrapped FlexBox components with CSS in JS
import { css } from 'glamor';
import { CSSProperties } from 'glamor';
import * as React from 'react';
import FlatButton from '../../presenters/atoms/FlatButton';
import Flexible, { FlexibleItem } from '../../presenters/atoms/Flexible';
import Grid, { Row, Cell } from '../../presenters/atoms/Grid';
import InputBox from '../../presenters/atoms/InputBox';
import Label from '../../presenters/atoms/Label';
type Props = {