Skip to content

Instantly share code, notes, and snippets.

View khadkarajesh's full-sized avatar
🏠
Working from home

Rajesh Khadka khadkarajesh

🏠
Working from home
View GitHub Profile
@khadkarajesh
khadkarajesh / collection_extension.dart
Created August 21, 2020 17:46
Dart's collection extension methods
extension CollectionExtension<T> on List<T> {
bool isNullOrEmpty() {
return this == null || this.length == 0;
}
}
extension CollectionNumExtension<T extends num> on List<T> {
T max() {
if (this.isNullOrEmpty()) throw Exception("Provide collection with items");
this.sort();
@khadkarajesh
khadkarajesh / conflict_collection_extension.dart
Created August 21, 2020 16:37
Extension method added on same type
extension CollectionExtension<T> on List<T> {
bool isNullOrEmpty() {
return this == null || this.length == 0;
}
}
extension CollectionNumExtension<T extends num> on List<T> {
T max() {
if (this.isNullOrEmpty()) throw Exception("Provide collection with items");
this.sort();
@khadkarajesh
khadkarajesh / collection_extension.dart
Created August 21, 2020 15:51
dart's collection extension
extension CollectionExtension<T> on List<T> {
bool isNullOrEmpty() {
return this == null || this.length == 0;
}
}
extension CollectionNumExtension<T extends num> on List<T> {
T max() {
if (this.isNullOrEmpty()) throw Exception("Provide collection with items");
this.sort();
@khadkarajesh
khadkarajesh / string_extension.dart
Created August 21, 2020 15:15
dart's string extension methods
extension StringExtension on String {
//will smith => Will Smith
String capitalize() {
return this
.trim()
.split(" ")
.where((e) => e.trim().length > 0)
.map((e) => "${e[0].toUpperCase()}"
"${e.length > 1 ? e.substring(1).toLowerCase() : ""}")
.join(" ");
@khadkarajesh
khadkarajesh / steps.md
Last active February 26, 2020 16:46
download postgresql data from remote server to local
  1. Access your database in remote server as psql -h '127.0.0.1' -U 'your_user' -d 'your_database'

  2. \copy (select * from your_table_name) to 'your_file_name.csv' with csv;

  3. Download file in your local machine scp -i your_pem_file.pem ec2-user@ip_address:/home/your_server_user/your_file.csv /home/your_local_user/Downloads/

  4. Access your local database same as step 1

import React, { Component } from "react";
import IncwellBootcamp from "IncwellTechnology";
class App extends Component {
state = {
enrolled: {}
};
componentDidMount() {
document.getElementsByClassName("Enroll")[0].addEventListener("click", this.enroll);
}
enroll = You => {
print("> I wanna be a professional software engineer.")
print("I can help you. <")
print("> How?")
def technical_support():
print("Technical Support Skill.")
automate_with_CI()
def training_on_git():
print('interview_preparation()')
fun main() {
//Anonymous
print("Hey how can i help you?")
// You
print("I want to be professional software engineer? but How")
//Anonymous
enrollIncwellBootcamp()