How to use packages that depend on Node.js core modules in React Native.
See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.
| "use strict"; | |
| // A function that wraps a given `React.DOM.input`-like component to | |
| // apply formatting to the value for display purposes. | |
| // | |
| // Example: | |
| // | |
| // var RoundedInput = createFormattedInput(React.DOM.input, { | |
| // set: Math.round, | |
| // }); |
Shortcut to perform a Google I'm Feeling Lucky search on https://developer.mozilla.org.
A number of fonts are available by default based on the platform (e.g., Roboto on Android, Helvetica on iOS). See the full list here.
| wget http://download.virtualbox.org/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12.iso | |
| sudo mkdir /media/iso | |
| sudo mount -o loop ./VBoxGuestAdditions_4.3.12.iso /media/iso | |
| sudo bash /media/iso/VBoxLinuxAdditions.run --nox11 | |
| sudo umount /media/iso |
| // Return the "pivot index" of the given array of numbers. The pivot index is | |
| // the index where the sum of the numbers on the left is equal to the sum of | |
| // the numbers on the right. | |
| function pivot(numbers) { | |
| validateInput(numbers); | |
| // Find a pivot index by testing each index | |
| for (var i = 0; i < numbers.length; i++) { | |
| var leftSum = sum(numbers.slice(0, i)); | |
| var rightSum = sum(numbers.slice(i + 1)); |
| # Determines how many cpus the virtual machine should be given. Uses half of | |
| # what's available on the host with a default of 4. | |
| def numvcpus | |
| begin | |
| os_cpu_cores / 2 | |
| rescue | |
| 4 | |
| end | |
| end |
className attribute instead of classhtmlFor attribute instead of for<textarea value="something"> instead of <textarea>something</textarea> (see Why Textarea Value)<select value="something"><option value="something"></select> instead of <select><option selected value="something"></select> (see Why Select Value)| class Plugin < ::Vagrant.plugin("2") | |
| name "build" | |
| action_hook('build') do |hook| | |
| hook.after(Vagrant::Action::Builtin::Provision, 2) do | |
| system("bash build.sh") | |
| end | |
| end | |
| end |