Skip to content

Instantly share code, notes, and snippets.

View amowu's full-sized avatar

Amo Wu amowu

View GitHub Profile
@amowu
amowu / brew-perms.sh
Created July 10, 2018 17:20 — forked from jaibeee/brew-perms.sh
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
@amowu
amowu / getAllCommits$.js
Last active October 22, 2018 08:42
GitHub API pagination with RxJS
const GitHubApi = require("github");
const Rx = require("rx");
const github = new GitHubApi();
const getCommitsAsync = (param) => github.repos.getCommits({
owner: 'amowu',
repo: 'test-semantic-release',
...param
});
export default function localitySelect(action$, store, { ajax }) {
return action$
.ofType('LOCALITY_AUTOCOMPLETE')
.debounceTime(150)
.distinctUntilChanged()
.switchMap(({ payload: { text, cursor } }) => {
return ajax
.getJSON(
`${api.searchSuggest}&cursor=${cursor}&string=${text}`
)
const plugins = [
// extract vendor and webpack's module manifest
new webpack.optimize.CommonsChunkPlugin({
names: [ 'vendor', 'manifest' ],
minChunks: Infinity
}),
// extract common modules from all the chunks (requires no 'name' property)
new webpack.optimize.CommonsChunkPlugin({
async: true,
children: true,
@amowu
amowu / responsiv-font.scss
Created April 26, 2017 14:40
响应式的字体大小的计算公式
$min-font-size: 16px;
$max-font-size: 24px;
$min-screen-size: 400px;
$max-screen-size: 800px;
font-size: calc($min-font-size + ($max-font-size - $min-font-size) * (100vw - $min-screen-size) / ($max-screen-size - $min-screen-size));
@amowu
amowu / theme.js
Created March 30, 2017 20:12 — forked from carl0zen/theme.js
Global Theme
export const theme = {
color: {
primary: "#47C51D",
secondary: '#53C1DE',
white: "#FFF",
black: "#222",
border: "rgba(0,0,0,0.1)",
base: "rgba(0,0,0,0.4)",
alert: '#FF4258',
success: 'mediumseagreen',
import styled from "styled-components";
import {
theme,
borderProps,
sizeProps,
backgroundColorProps,
marginProps
} from "ui";
const { color, font, topbar, gutter } = theme;
// Mixin like functionality
const textInput = props => `
color: ${props.error ? color.white : color.base};
background-color: ${props.error ? color.alert : color.white};
`;
export const Input = styled.input`
${textInput}
`;
// Prop passing Shorthands for Styled-components
export const borderProps = props => css`
${props.borderBottom && `border-bottom: ${props.borderWidth || "1px"} solid ${color.border}`};
${props.borderTop && `border-top: ${props.borderWidth || "1px"} solid ${color.border}`};
${props.borderLeft && `border-left: ${props.borderWidth || "1px"} solid ${color.border}`};
${props.borderRight && `border-right: ${props.borderWidth || "1px"} solid ${color.border}`};
`;
export const marginProps = props => css`
${props.marginBottom && `margin-bottom: ${typeof (props.marginBottom) === "string" ? props.marginBottom : "1em"}`};
import styled from "styled-components";
import {
theme
} from "ui";
const { color, font, radius, transition } = theme;
export const Button = styled.button`
background-color: ${color.ghost};