Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math| // Helpers. | |
| import { convertToText } from './'; | |
| /* | |
| You would call this when receiving a plain text | |
| value back from an API, and before inserting the | |
| text into the `contenteditable` area on a page. | |
| */ | |
| const convertToMarkup = (str = '') => { | |
| return convertToText(str).replace(/\n/g, '<br>'); |
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math| var HashTable = function() { | |
| this._storage = []; | |
| this._count = 0; | |
| this._limit = 8; | |
| } | |
| HashTable.prototype.insert = function(key, value) { | |
| //create an index for our storage location by passing it through our hashing function | |
| var index = this.hashFunc(key, this._limit); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <?php | |
| ////////////////////////////////// | |
| // Reddit "hot" story algorithm // | |
| ////////////////////////////////// | |
| function hot($ups, $downs, $date) | |
| { | |
| if (is_string($date)) $date = strtotime($date); | |
| $s = $ups - $downs; |