This file contains 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
Hosting a website on firebase | |
Go to project dir | |
- <b>npm install -g firebase-tools</b> | |
- <b>firebase login</b> | |
- Login successfully before executing any other command | |
- <b>firebase init</b> | |
- Select hosting feature and github deploy actions | |
- Procceed | |
- Select a Project where this will be deployed | |
- Test website on local machine with firebase serve |
This file contains 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
View v = getCurrentFocus(); // get current view in focus | |
//get x,y coordinates of view | |
int[] scrcoords = new int[2]; | |
v.getLocationOnScreen(scrcoords); | |
float x = ev.getRawX() + v.getLeft() - scrcoords[0]; | |
float y = ev.getRawY() + v.getTop() - scrcoords[1]; | |
//check if the touch was outside the current view | |
if (x < v.getLeft() || x > v.getRight() || y < v.getTop() || y > v.getBottom()) { |
This file contains 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
String strings = Utils.decodeString(mChannelObj.getDescription()); | |
tvDescription.setVisibility(VISIBLE); | |
descriptionDivView.setVisibility(VISIBLE); | |
SpannableStringBuilder span = new SpannableStringBuilder(strings); | |
Pattern webPattern = Patterns.WEB_URL; | |
Matcher matcher = webPattern.matcher(Utils.decodeString(mChannelObj.getDescription())); | |
while (matcher.find()) { | |
ClickableSpan clickableSpan = new ClickableSpan() { | |
@Override |
This file contains 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
It gives software developers a mediation layer between the domain of the application and the raw data fetched | |
from the data source. | |
Repository pattern is a great idea, and it’s what Store is based on: instead of accessing the network layer directly, | |
the library should be invoked, giving a wide range of benefits. | |
One of them is the possibility of persisting the data so that it can be accessed while offline. | |
This brings us to the next step, the record duration policy: within Store it’s possible to declare how long the data | |
should persist. | |
There is control over whether to fetch fresh data when what’s currently on disk is stale, or not. | |
Store also provides total freedom on how to fetch, parse and persist data, while still giving good defaults. |
This file contains 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
Given a Binary Tree, convert it into its mirror. | |
1 1 | |
/ \ / \ | |
3 2 ====> . 2 . 3 | |
/ \ / \ | |
5 4 4 5 | |
traverse(node){ |
This file contains 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
AppStore supports images of size 40X40, 60X60,58X58, 87X87, 120X120, 180X180 ,1024X1024 and 80X80 (all in pixels). | |
It might be a tiresome job (for lazy ppl like me ) to resize a given image to above supported formats using Preview. | |
This is the reason god invented CLI. To avoid pixel-ation of images let's use an 1024X1024 image to be resized . Let's create | |
8 copies of this image. | |
Rename the original image to 1024.png | |
Using the following commands to create multiple copies | |
cp 1024.png 80.png | |
cp 1024.png 60.png | |
cp 1024.png 180.png |
This file contains 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
installation -> npm intsall react-native-truecaller --save | |
linking -> react-native link react-native-truecaller | |
and on running react-native run-android | |
we get the following error which points to react-native-truecaller | |
``` | |
FAILURE: Build failed with an exception. | |
* Where: | |
Build file '/Users/ayushbansal/Sites/cybertron/cybertron-starscream/node_modules/react-native-truecaller/android/build.gradle' line: 5 |
This file contains 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
1) Connect your mobile device via usb (just this once) | |
2) Establish a port with your mobile device using 'adb tcpip <port number>'. | |
eg. adb tcpip 5555 | |
3) Remove USB and 'adb connect <mobile device ip><above mentioned port number>' . | |
Eg . adb connect 192.160.0.124:5555 | |
4) 'React-native run-android' in your project folder |
This file contains 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
Diff in left and right height should be less than or equal to 1. | |
int traverse(node){ | |
if(node == null) | |
return 0; | |
int leftHeight = traverse(node->left); | |
int rightHeight = traverse(node->right); | |
isBalanced(leftHeight,rightHeight,node); | |
return max(leftHeight,rightHeight) + 1; | |
} |
This file contains 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
//in babel //in javascript | |
const arr1 = ['a','b','c']; var arr1 = ['a', 'b', 'c']; | |
const arr2 = ['d','e','f']; var arr2 = ['d', 'e', 'f']; | |
var arr3= [...arr1,...arr2]; var arr3 = [].concat(arr1, arr2); |
NewerOlder