Skip to content

Instantly share code, notes, and snippets.

View pjchender's full-sized avatar

Aaron Chen pjchender

View GitHub Profile
@pjchender
pjchender / _form.html.erb
Created July 23, 2018 09:36
Quill + Rails + Stimulus
<!-- ./app/views/posts/_form.html.erb -->
<div class="form-group mb-3">
<%= content_fields.label :body, class: 'col-form-label' %>
<div data-controller="quill-editor">
<div data-target="quill-editor.container" style="min-height: 250px;"></div>
<%= content_fields.text_area :body, class: 'form-control d-none', placeholder: 'Content' %>
</div>
</div>
@pjchender
pjchender / package.js
Created May 18, 2018 02:24
Webpack 4 常用設定
// package.json
{
"name": "webpack-sandbox",
"sideEffects": false,
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"build": "webpack -p",
"watch": "webpack --watch", // 當檔案有變更時會重 build
@pjchender
pjchender / README.md
Created February 25, 2018 04:34
好文收藏 by PJCHENder
@pjchender
pjchender / getLocations.js
Last active February 9, 2018 07:24
取得全國藝文活動展演場地
/* eslint-disable */
const request = require('request')
const cheerio = require('cheerio')
const async = require('async')
const path = require('path')
const fse = require('fs-extra')
let getLocationURL = 'https://event.moc.gov.tw/'
let pageSize = '100'
@pjchender
pjchender / computer_science_terms.md
Last active October 25, 2022 04:59
[CS] Computer Science 專有名詞(繁簡對照)

[CS] Computer Science 專有名詞(繁簡對照)

英文 台灣(繁體) 中國(簡體)
Array 陣列 數組
Object 物件 對象
variable 變數 變量
literal 字面量
expression 表達式 表達式
statement 陳述式 陳述式/語句
@pjchender
pjchender / README.md
Created July 31, 2017 02:31
Gulp BrowserSync
tags: gulp, browsersync, browser reload, autoreload

This is a simple web server for auto browsersync.

@pjchender
pjchender / validate_object.js
Last active July 13, 2017 14:04
Snippet - Validation Object with Required
/**
* 利用 validate function 可以驗證 object 中的必填欄位有無填寫
**/
// object validation rules
const schema = {
firstName: {
required:true
},
lastName: {
@pjchender
pjchender / post-vm.js
Last active June 22, 2017 10:24
Vue Reactivity Demo
const request = window.superagent;
const root = "https://jsonplaceholder.typicode.com";
const postVm = new Vue({
el: "#post",
data: {
post: {
userId: "",
id: "",
title: ""
@pjchender
pjchender / authenticate.js
Last active June 21, 2017 07:25
Dive into Passport JS
// ./node_modules/passport/lib/middleware/authenticate.js
/**
* Module dependencies.
*/
var http = require('http'),
IncomingMessageExt = require('../http/request'),
AuthenticationError = require('../errors/authenticationerror')
/**
@pjchender
pjchender / app.js
Created May 22, 2017 14:22
[Node][Unit 38] Call and Apply
let obj = {
name: 'Aaron Chen',
greet: function () {
console.log(`Hello ${this.name}`)
}
}
obj.greet()
obj.greet.call({name: 'Andy Chang'})