These rules are adopted from the AngularJS commit conventions.
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
var todo = (function(){ | |
var tasks = []; | |
var addTask = (function(){ | |
var id = 0; | |
return function(title){ | |
var result = id; | |
tasks.push({id: id++, title: title, state: STATE.PROGRESS()}); | |
render(); | |
return result; |
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
var Html = function(){}; | |
Html.prototype = new Renderer(); | |
Html.prototype._init = function(){ | |
if(typeof this.completeLi !== 'undefined' && typeof this.progressLi !== 'undefined') { | |
return; | |
} | |
this.progressLi = document.querySelector('#todo .progress li'); | |
this.completeLi = document.querySelector('#todo .complete li'); |
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
for (var i = 1; i <= 9; i++) { | |
for (var j = 1; j <= 9; j++) { | |
console.log(i, 'X', j, '=', i * j); | |
} | |
} | |
eachDan(7); | |
for (var i = 8; i <= 18; i += 2) eachDan(i); | |
printDan([3, 7, 9, 13]); |
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 { useState, useRef, useEffect, useCallback } from 'react'; | |
import throttle from 'lodash/throttle'; | |
const useDetectScrollEnd = (endPercent = 0.9) => { | |
const scrollEnded = useRef(false); | |
const [isScrollEnd, setIsScrollEnd] = useState(false); | |
const handleScroll = useCallback(throttle(() => { | |
const { scrollY, innerHeight } = window; | |
const scrollPercent = (scrollY + innerHeight) / document.body.scrollHeight; |
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
// Engine | |
const React = { | |
index: 0, | |
state: [], | |
useEffect: (callback, dependencies) => { | |
const cachedIndex = React.index; | |
const hasChanged = dependencies !== React.state[cachedIndex]; | |
if (dependencies === undefined || hasChanged) { | |
callback(); |
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
.next | |
__generated__ |