This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question: How to debug reactnative JS remotely in android? | |
Solution: | |
Start up your android vm/ emulator | |
Navigate to you project folder and in terminal, type “react-native run-android” | |
Open chrome and visit localhost:8081/debugger-ui | |
In terminal, type “adb shell input keyevent 82” , to bring up the dev menu | |
Select “debug JS remotely” | |
Refresh chrome | |
Press ‘r’ two times in the android vm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
2.4.3 :001 > def foo(a:1, b:2) | |
2.4.3 :002?> print "#{a}#{b}" | |
2.4.3 :003?> end | |
=> :foo | |
2.4.3 :004 > def foobar(a:1, b:2) | |
2.4.3 :005?> foo(a,b) | |
2.4.3 :006?> end | |
=> :foobar | |
2.4.3 :007 > foobar(3,4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am seeing this error after running rspec: | |
Failure/Error: raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}" | |
AbstractController::ActionNotFound: | |
The action 'index' could not be found for Api::V1::ExpertSchedulesController | |
All other routes are not throwing error in the controller. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
put in 'before' block inside rspec scenario: | |
@time_now = Time.parse("2018-03-08T00:00:00.000Z") | |
allow(Time).to receive(:now).and_return(@time_now) | |
You should see that the Time.now is being used in rspec scenario, but this won't be used in factory_bot. | |
You can selectively use it in certain test cases. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First you need to expose your CSRF token | |
SessionsController.rb: | |
def new | |
render json: {"CSRF": form_authenticity_token} | |
end | |
When you visit GET sign_in path, you will get the CSRF token. | |
To sign_in with POST, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preparing the bootable pendrive | |
1. Download http://wincmd.ru/black_dog/v6535/crdisk.rar, password is "crisis" | |
2. Download Ultimate BIOS-Boot-Edition from https://biosflash.com/e/bios-boot-usb-stick.html | |
3. Follow the steps in biosflash.com until you finish created the USB bootable drive | |
4. Download driver from Toshiba https://support.toshiba.com/support/viewContentDetail?contentId=2486122 | |
5. Extract the downloaded driver file, you will able to see PR10M150.fd | |
6. Copy all the files extracted from crdisk.rar to the bootable pendrive, you should able to see PHLASH16.exe when you open you pendrive | |
7. Copy PR10M150.fd to bootable pendrive, then rename it to BIOS.FD | |
8. Remove BIOS.WPH file from the bootable pendrive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/https' | |
# To know more can visit http://www.rubydoc.info/stdlib/net/Net/HTTP | |
# For http only website, can use quirktools.com | |
# For weird SSL cert, can use ktmb.com.my | |
# For self-signed cert, use self-signed.badssl.com | |
# More example: https://badssl.com/ | |
if ARGV[0] | |
host = ARGV[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here are the steps to have working virtualenv: | |
$ pip install virtualenv | |
$ sudo /usr/bin/easy_install virtualenv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GooiBot < RTanque::Bot::Brain | |
NAME = 'gooi_bot' | |
include RTanque::Bot::BrainHelper | |
MAX_RAND_DIVISION = 10.0 | |
def tick! | |
## main logic goes here | |
@current_heading ||= sensors.heading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: | |
(byebug) devise_parameter_sanitizer.sanitize(:sign_up) | |
{} | |
Investigation: | |
1. We post the data to the backend in this format | |
``` | |
$ curl -X POST -H "Content-Type: application/json" --data "{\"user\": {\"email\":\"[email protected]\", \"password\": \"1234567890\", \"password_confirmation\": \"1234567890\"}}" localhost:3000/api/v1/users | |
``` |