Real unit test (isolation, no children render)
Calls:
- constructor
- render
| <!-- | |
| Put this file in ~/Library/LaunchAgents/com.example.KeyRemapping.plist to | |
| automatically remap your keys when macOS starts. | |
| See https://developer.apple.com/library/archive/technotes/tn2450/_index.html for | |
| the key "usage IDs". Take the usage ID and add 0x700000000 to it before putting it | |
| into a source or destination (HIDKeyboardModifierMappingSrc and | |
| HIDKeyboardModifierMappingDst respectively). | |
| --> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| class MinHeap { | |
| constructor () { | |
| /* Initialing the array heap and adding a dummy element at index 0 */ | |
| this.heap = [null] | |
| } | |
| getMin () { | |
| /* Accessing the min element at index 1 in the heap array */ | |
| return this.heap[1] |
| function getTranslate(item: HTMLElement): number | number[] | undefined { | |
| const transArr = []; | |
| if (!window.getComputedStyle) { | |
| return; | |
| } | |
| const style = window.getComputedStyle(item); | |
| const transform = style.transform || style.webkitTransform; | |
| let mat = transform.match(/^matrix3d\((.+)\)$/); | |
| if (mat) { | |
| return parseFloat(mat[1].split(', ')[13]); |
| import * as React from 'react' | |
| import { connect } from 'react-redux' | |
| // | |
| // Higher order component (HOC) to provide Anti-Forgery Token | |
| // to a component that needs to send POST request to a back-end | |
| // controller action that has an attribute [ValidateAntiForgeryTokenHeader] | |
| // | |
| export function AntiForgeryTokenized<P extends WithToken>( | |
| Comp: React.ComponentClass<P> | React.StatelessComponent<P> |
| // Add a 401 response interceptor | |
| window.axios.interceptors.response.use(function (response) { | |
| return response; | |
| }, function (error) { | |
| if (401 === error.response.status) { | |
| swal({ | |
| title: "Session Expired", | |
| text: "Your session has expired. Would you like to be redirected to the login page?", | |
| type: "warning", | |
| showCancelButton: true, |
| # View registry settings | |
| Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | |
| # Change registry settings | |
| # Reverse mouse wheel scroll FlipFlopWheel = 1 | |
| # Normal mouse wheel scroll FlipFlopWheel = 0 | |
| Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 } | |
| # Restore default scroll direction | |
| # Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 1 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 0 } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-3.0.0.js"></script> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script> |
| #!/bin/bash | |
| brew install redis # Install Redis using Homebrew | |
| ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart | |
| launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl | |
| # homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf | |
| redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop | |
| redis-cli ping # Check if the Redis server is running |
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.