Skip to content

Instantly share code, notes, and snippets.

View kumarandena's full-sized avatar
🎯
Focusing

Kumaran kumarandena

🎯
Focusing
  • India
View GitHub Profile
@kumarandena
kumarandena / verticallycenterlabel.md
Last active May 9, 2019 06:41
Vertically Center Label Text in NativeScript Android

There are some differences how iOS and Android work with layouts with no predefined sizes which is causing this different output for your code. In your case your Label is wrapped in the default StackLayout with no dimensions and this is one of the reason not to be able to position your label at the vertical center. Another thing is the percentage value of your label set to 100%.

What I can suggest is to use different layouts for cases when you need to control both horizonal and vertical aligment.

e.g.

<GridLayout rows="*" columns="*" style.backgroundColor="gray" >
    <Label row="0" text="vertically centered" style.verticalAlignment="center" style.textAlignment="center" textWrap="true">       </Label>
@kumarandena
kumarandena / Run Debug Mode In NativeScript IOS
Created May 6, 2019 19:47
How to run the app in debug mode in an iOS real device
Run in iOS device
* tns run ios
* If no certificate found, You will get an error
Prepare certificate
* tns prepare ios
* Open xcWorkspace file which is in platform/ios using xcode
* build the app Once certificate ready then head over to visual studio code then try to run again
@kumarandena
kumarandena / ID.js
Created May 3, 2019 06:30
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
@kumarandena
kumarandena / NativeScript jsPDF
Created May 3, 2019 06:21
jsPDF Javascript library integration with NativeScript Angular
Library Github Repo - https://github.com/MrRio/jsPDF
Integration:
1. Let’s create Nativescript angular project
npm install jspdf –save
npm install @types/jspdf –save
npm install base-64 --save
2. Verify whether it is installed or not
@kumarandena
kumarandena / NativeScript PdfMake
Created May 3, 2019 06:21
PdfMake Javascript library integration with NativeScript Angular
PdfMake Javascript library integration with NativeScript Angular
Library Github Repo - https://github.com/bpampuch/pdfmake
Integration:
1. Let’s create Nativescript angular project
Install PdfMake Library
npm i pdfmake
2. Verify whether it is installed or not
@kumarandena
kumarandena / Git Commands
Created May 1, 2019 16:16
Useful GIT Commands
Basic Commands:
git fetch --all (Fetch all of the branches from the repository)
git checkout branchname (to change the local branch)
git pull (to take all latest from origin)
git branch (to check current branch and list all branches)
@kumarandena
kumarandena / Edit bash profile
Created May 1, 2019 09:24
Edit bash profile on Mac
open bash profile - https://stackoverflow.com/questions/30461201/how-do-i-edit-path-bash-profile-on-osx
save changes - https://apple.stackexchange.com/questions/52461/how-to-save-and-exit-nano-bash-profile-in-terminal
1. Install GIPHY CAPTURE on mac.
2. Play the video using QuickTime player then start the giphy capture and create gif file.
3. Set Resolution of the frame - 384*740
@kumarandena
kumarandena / FizzBuzz.ts
Last active April 4, 2019 05:30
Fizz Buzz problem - Decisions
//logic#1.ts
//bit ugly method
FizzBuzz() {
for (let i = 1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0 && i % 2 === 0 && i % 6 === 0 && i % 4 === 0 && i % 7 === 0 && i % 8 === 0) {
console.log("Fizz Buzz Test six four seven eight ")
}
else if (i % 3 === 0 && i % 5 === 0 && i % 2 === 0 && i % 6 === 0 && i % 4 === 0 && i % 7 === 0) {
console.log("Fizz Buzz Test six four seven ")
@kumarandena
kumarandena / home.component.ts
Last active April 9, 2019 11:28
Create SQLite query from an Array (NativeScript with Angular)
import { Component, OnInit } from "@angular/core";
var dialogs = require("tns-core-modules/ui/dialogs");
var clipboard = require("../nativescript-clipboard");
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ["./home.component.css"]