- html, cssコーディング
- 静的コンポーネント作成
- store設計 (JSON)
- storeを参考にactionTypesを作成
- actionTypesからactionCreatorsを実装
- XHRはmodelに
- actionCreatorsreducerを作成
- mountComponentとmountComponentWithRedux関数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { component$, $, useStore, useContextProvider, createContextId, useContext, Slot } from "@builder.io/qwik"; | |
export function createTab<T extends string[]>(tabKeys: T, initial?: T[number]) { | |
type TabStore = { activeKey: T[number] } | |
const TabContext = createContextId<TabStore>('Tab_' + tabKeys.join('_')); | |
const Tab = component$(() => { | |
const store = useStore({ activeKey: initial ?? tabKeys[0] }) | |
useContextProvider(TabContext, store) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('hoge') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const memoizeSelector = (getDeps, selector) => { | |
const lastDeps = [] | |
let lastResult | |
return (store) => { | |
let updated = false | |
const deps = getDeps.map((getDep, i) => { | |
const dep = getDep(store) | |
if (dep !== lastDeps[i]) { | |
lastDeps[i] = dep | |
updated = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(bgStyle){ window.open(bgStyle.replace(/^url\("/,'').replace(/"\)$/,'').replace('magazine_cover_landscape_', '')+'?crop=1.6:0.27') })(document.querySelector('.o-magazineHeader__cover').style.backgroundImage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.spyOn(file, 'size', 'get').mockReturnValue(10001) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateImageSize(file: File): boolean { | |
return file.size < 10000 | |
} | |
describe('when the file size is exceeded the limitation', () => { | |
it('returns false', () => { | |
const dummyFile = new File([''], 'example.jpg') | |
dummyFile.size = 10001 | |
expect(validateImageSize(dummyFile)).toBe(false) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getUser(httpClient: HttpClient, userId: number): Promise<User> { | |
const res = await httpClient.get(`/api/users/${userId}`) | |
return res.data.user | |
} | |
describe('when the API ends in successful', () => { | |
it('returns the user data', async () => { | |
const get = jest.fn(() => { | |
return Promise.resolve({ | |
data: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default defineComponent({ | |
setup() { | |
const state = reactive({ | |
count: store.state.count, | |
}) | |
return { | |
state, | |
increment() { | |
store.dispatch('increment') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bundle exec derailed bundle:mem production | |
TOP: 63.3555 MiB | |
rails/all: 18.3711 MiB | |
rails: 10.6133 MiB (Also required by: active_record/railtie, active_model/railtie, and 13 others) | |
active_support: 3.8711 MiB (Also required by: active_support/railtie, active_support/i18n_railtie, and 10 others) | |
active_support/logger: 3.082 MiB | |
active_support/logger_silence: 2.9805 MiB | |
concurrent: 2.9258 MiB (Also required by: sprockets/manifest) | |
concurrent/executors: 1.0586 MiB | |
concurrent/executor/timer_set: 0.4961 MiB |
NewerOlder