https://github.com/despairblue/productivemobile
https://github.com/despairblue/productivemobile
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/despairblue/productivemobile
- Owner: despairblue
- Created: 2015-12-04T15:16:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-04T15:45:14.000Z (over 9 years ago)
- Last Synced: 2025-02-24T02:56:53.379Z (4 months ago)
- Language: HTML
- Homepage: https://despairblue.github.io/ProductiveMobile/Google%20Movies%20HTML/Movie%20Showtimes%20-%20Google%20Search.htm
- Size: 1.7 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ProductMobile
## General
I don't have anything against semicolons,
I simply chose https://github.com/feross/standard/ as a style guide for my
private projects.## Part I
### Running It
```bash
cd 'Part I'
npm i
npm test
```
If you want to require the function in your own code either
* run `npm run build` first and use the transpiled version in the build directory or
* make sure that you require `babel-register` first or
* run your script with `babel-node` from the `node_modules/.bin` directory### Files
* `noMoreThanNTimesPerSecond.js`
* contains the implemented function
* `index.spec.js`
* requires `babel-register` and then `spec.js`
* `spec.js`
* contains the test suite### Notes
It wasn't quite clear to me when the timeout is supposed to be reset:
* every time a second passes or
* every time the function is called after at least a second passed or
* if it is a sliding time window (which could be the case considering this sentence `the ‘wrapped’ function should not call the original ‘fn’ function more than ‘n’ times per second`)See [this](https://gist.github.com/despairblue/2163ece48ee265968a08) for further explanation.
I opted for the second case here since it's the one that requires the least calculations and state and one of the purposes of this function was save CPU cycles by not calling an expensive function.
## Part II
![]()
:arrow_down:![]()
### Running It
```bash
cd 'Google Movies HTML'
npm i
npm start
```
Open `http://0.0.0.0:8080/Movie%20Showtimes%20-%20Google%20Search.htm` in your Browser, once webpack finished the bundle.### Files
* `index.js`
* contains all components### Notes
* I commented most ideas, hacks and hints throughout the source code in `index.js`
* Basically I pass the body to a React component that queries different parts of the body and in turn passes those to other React components and so on. The components walk the DOM and return a mobile view of the same information.
* The old content is hidden via `display: none`, it could also be removed, it just didn't seem necessary.
* I tried to reuse as much of the old page as possible, including styles, thus all the `dangerouslySetInnerHTML`
* the content comes from the original static site, so this shouldn't be dangerous