Skip to content

Instantly share code, notes, and snippets.

@jaceju
jaceju / AceEditor.vue
Created November 5, 2019 04:15
在 Vue 裡用 AceEditor
<template>
<div
:style="{ height: myOptions.height + 'px', width: myOptions.width + 'px' }"
></div>
</template>
<script>
import { edit } from "ace-builds";
const defaultOptions = {
@jaceju
jaceju / static.php
Created June 14, 2019 02:41
Static variable in PHP function
<?php
function f($n) {
static $result = [];
if (isset($result[$n])) {
return $result[$n];
}
if ($n <= 2) {
@jaceju
jaceju / vue.config.js
Last active September 5, 2022 05:19
Webpack resolve alias in PhpStorm/WebStorm
// @see https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000556284-vue-import-component-Module-is-not-installed-?page=2#community_comment_360000146344
// If you use vue-cli 3:
// Put this file to root folder fo the project
// Open PhpStorm or WebStorm, and goto
// Perferences / Languages & Frameworks / JavaScript / Webpack
// webpack configuration file: </path/to/project/node_modules/@vue/cli-service/webpack.config.js>
const path = require("path");
function resolve(dir) {
install-deps:
image: our-registry:5000/php:7.2
stage: prepare
script:
- composer --no-dev install --no-scripts
artifacts:
expire_in: 1 week
paths:
- vendor/
@jaceju
jaceju / Dockerfile
Created January 9, 2019 10:00
Ubuntu Install Java 8
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199#23
RUN mkdir -p /usr/share/man/man1 && \
apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-8-jdk && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache
@jaceju
jaceju / index.js
Last active December 19, 2018 02:55
Export modules under a directory (Node.js)
const camelCase = require('camelcase');
require('fs').readdirSync(__dirname + '/').forEach(file => {
if (file.endsWith('js') && file !== 'index.js') {
var name = file.replace('.js', '');
exports[camelCase(name)] = require('./' + file);
}
});
@jaceju
jaceju / laravel-valet-curl-issue.md
Created November 20, 2018 07:50
Laravel Valet 的 curl 問題

問題

用 Valet secure 過的網站,用 curl 打的時候會遇到:

cURL error 60: SSL certificate problem: unable to get local issuer certificate

解決方法

@jaceju
jaceju / b-components.js
Last active March 14, 2020 16:15
Register BootstrapVue's components and directives for PhpStorm/WebStorm
import Vue from 'vue';
import bAlert from 'bootstrap-vue/es/components/alert/alert';
import bBadge from 'bootstrap-vue/es/components/badge/badge';
import bBreadcrumb from 'bootstrap-vue/es/components/breadcrumb/breadcrumb';
import bBreadcrumbItem from 'bootstrap-vue/es/components/breadcrumb/breadcrumb-item';
import bBreadcrumbLink from 'bootstrap-vue/es/components/breadcrumb/breadcrumb-link';
import bButton from 'bootstrap-vue/es/components/button/button';
import bButtonClose from 'bootstrap-vue/es/components/button/button-close';
import bButtonGroup from 'bootstrap-vue/es/components/button-group/button-group';
import bButtonToolbar from 'bootstrap-vue/es/components/button-toolbar/button-toolbar';
@jaceju
jaceju / AbstractStep.php
Last active July 19, 2018 02:32
Chain of Responsibility Pattern Example
<?php
abstract class AbstractStep
{
protected $successor;
protected $shouldPassToSuccessor = true;
public static function registerSteps(array $steps): AbstractStep
{