$ sudo install -o redis -g redis -d /var/lib/redis2
$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
| #set connection data accordingly | |
| #Will only work for redis > 5.0 | |
| #Easiest way | |
| #if it doesnt work , then try with target_db=0 for both | |
| #Also always use -c after redis-cli . Or else the redirection wont work and it will throw (error) Move | |
| #There are multiple ways of doing it. One is via MIGRATE command , 2nd is via DUMP and RESTORE command. | |
| source_host=localhost | |
| source_port=6379 |
| const SCROLL_UP = "up"; | |
| const SCROLL_DOWN = "down"; | |
| const useScrollDirection = ({ | |
| initialDirection, | |
| thresholdPixels, | |
| off | |
| } = {}) => { | |
| const [scrollDir, setScrollDir] = useState(initialDirection); |
| <?php | |
| $currency_symbols = array( | |
| 'AED' => 'د.إ', // ? | |
| 'AFN' => 'Af', | |
| 'ALL' => 'Lek', | |
| 'AMD' => 'դ', | |
| 'ANG' => 'ƒ', | |
| 'AOA' => 'Kz', // ? | |
| 'ARS' => '$', | |
| 'AUD' => '$', |
| #!/bin/sh | |
| readonly cluster_topology=$(redis-cli -h redis-cluster cluster nodes) | |
| readonly slaves=$(echo "${cluster_topology}" | grep slave | cut -d' ' -f2,4 | tr ' ' ',') | |
| readonly backup_dir="/opt/redis-backup" | |
| mkdir -p ${backup_dir} | |
| for slave in ${slaves}; do | |
| master_id=$(echo "${slave}" | cut -d',' -f2) |
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
In React's terminology, there are five core types that are important to distinguish:
React Elements
(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.
| /** | |
| * Resizes the canvas for high DPI (retina) screens. | |
| * | |
| * Modified from here: http://www.html5rocks.com/en/tutorials/canvas/hidpi/ | |
| * | |
| * By Paul Lewis, customized by Mike Kohn | |
| */ | |
| var HDPICanvas = (function() { | |
| function scale(canvas) { |